#
1.5 Compatibility with previous versions

Newer versions have usually numerous bug fixes compared with the previous version. But we also sometimes introduce some incompatibilities with older versions. Not just for the fun of it, but to make the compiler more stable, efficient and standard compliant (see section 3.1 for Standard-Compliance). This is a list of such changes .

- short is now equivalent to int (16 bits), it used to be equivalent to char (8 bits) which is not ANSI compliant. To maintain compatibility, old programs could be compiled using the —short-is-8bits command line option (option removed after the 3.6.0 release).
- the default directory for gcc-builds where include, library and documentation files are stored is now in /usr/local/share.
- char type parameters to vararg functions are casted to int unless explicitly casted and neither of the —std-c89, —std-c99, —std-c11 or —std-c2x command line options is used, e.g.:
  char a=3;
  printf (%d %c\n, a, (char)a);
  will push a as an int and as a char resp if none of the above command line options are not defined,
  will push a as two ints if none of the above command line option is defined.
- pointer type parameters to vararg functions are casted to generic pointers on Harvard architectures (e.g. mcs51, ds390) unless explicitly casted and neither of the —std-c89, —std-c99, —std-c11 or —std-c2x command line options is used.
- option —regextend has been removed.
- option —noregparms has been removed.
- option —stack-after-data has been removed.
- __bit and __sbit types now consistently behave like the C99 _Bool type with respect to type conversion. The most common incompatibility resulting from this change is related to bit toggling idioms, e.g.:
  __bit b;
  b = ~b; /* equivalent to b=1 instead of toggling b */
  b = !b; /* toggles b */
  In previous versions, both forms would have toggled the bit.
- in older versions, the preprocessor was always called with —std-c99 regardless of the —std-xxx setting. This is no longer true, and can cause compilation failures on code built with —std-c89 but using c99 preprocessor features, such as one-line (//) comments
- in versions older than 2.8.4 the pic16 *printf() and printf_tiny() library functions supported undocumented and not standard compliant 'b' binary format specifier (%b, %hb and %lb). The 'b' specifier is now disabled by default. It can be enabled by defining BINARY_SPECIFIER macro in files device/lib/pic16/libc/stdio/vfprintf.c and device/lib/pic16/libc/stdio/printf_tiny.c and recompiling the library.
- in versions older then 2.8.5 the unnamed bit-field structure members participated in initialization, which is not conforming with ISO/IEC 9899:1999 standard (see section Section 6.7.8 Initialization, clause 9)
  Old behaviour, before version 2.8.5:
  struct {
  int a : 2;
  char : 2;
  int b : 2;
  } s = {1, 2, 3};
  /* s.a = 1, s.b = 3 */
  New behaviour:
  struct {
  int a : 2;
  char : 2;
  int b : 2;
  } s = {1, 2};
  /* s.a = 1, s.b = 2 */
- In 2.9.0 libraries included in SDCC packages, are in ar format. See section 3.2.5.
- In 3.0.0 targets for xa51 and avr are disabled by default.
- In 3.0.0 sdldgb and sdldz80 don't support generation of Game Boy binary image format. The makebin utility can be used to convert Intel Hex format to Game Boy binary image format.
- In 3.0.0 sdldgb and sdldz80 don't support generation of rrgb (Game Boy simulator) map file and no$gmb symbol file formats. The as2gbmap utility can be used to convert sdld map format to rrgb and no$gmb file formats.
- In 3.1.0 asranlib utility was renamed to sdranlib.
- In 3.1.0 pic14 target, structured access to SFR via <sfrname>_bits.<bitname> is deprecated and replaced by <sfrname>bits.<bitname>. It will be obsoleted (removed) in one of next SDCC releases. See section 4.6.8.3.
- sdar archive managing utility and sdnm utilities were introduced in version 3.2.0. sdar, sdranlib and sdnm are derived from GNU Binutils package.
- In 3.2.0 the sdcclib utility is deprecated. Sdar utility should be used to create SDCC object file archives. Sdcclib utility will become obsolete in one of next SDCC releases and will be removed from SDCC packages.
- In 3.2.0 special SDCC keywords which are not preceded by a double underscore are obsoleted (removed). See section 3.1 Standard-Compliance.
- In 3.2.0 compiler macro definitions not starting with double underscore characters are deprecated if --std-cXX command line option is defined. They have been obsoleted (removed) after the 3.4.0 release (except for the macro SDCC, which has been removed after the 3.6.0 release (and brought back for mcs51 for the 3.7.0 release)).
- In 3.2.0 new compiler macros for processor definition were introduced for pic14 and pic16 targets: -D__SDCC_PIC16XXXX and -D__SDCC_PIC18FXXX respectively. The pic16 macro definition -D__18fXXX is deprecated. It was obsoleted (removed) after the 3.4.0 release.
- In 3.2.0 pragma config for pic16 target was introduced. See section 4.7.6
- In 3.2.0 new inline assembler format __asm__ (inline_assembler_code”); as an addition to __asm ... __endasem; format introduced. See section 3.11
- sdobjcopy utility was introduced in version 3.3.0. It is derived from GNU Binutils package.
- Before 3.4.0 release, intrinsic named address spaces were called ”storage classes” in this manual.
- In 3.6.0, the default for char changed from signed to unsigned.
- In 3.7.0, the prototype for putchar() changed from void putchar(char) to int putchar(int).
- In 3.7.0 mcs51 and ds390 got a full _Bool/bool type, separate from __bit.
- In 3.7.0, the option –nojtbound and the corresponding pragma have been deprecated.
- In 3.7.0, the prototype for getchar() changed from char getchar(void) to int getchar(void).
- In 3.8.6, the deprecated sdcclib was removed.
- In 4.0.3, _itoa, _uitoa, _ltoa, _ultoa were renamed to __itoa, __uitoa, __ltoa, __ultoa.
- In 4.1.1, typeof.h has been removed.
- In 4.1.3, support for —oldralloc has been removed for the z80-related backends.
- In 4.1.10, the default calling convention switched from __sdccall(0) to __sdccall(1) for stm8 and gbz80.
- In 4.1.10, support for –profile has been removed for gbz80.
- In 4.1.11, the minimum Z80N Core version for the z80n port has been raised from 1.0 to 2.0.
- In 4.1.12, the default calling convention switched from __sdccall(0) to __sdccall(1) for z80, z180 and z80n.
- In 4.1.12, support for –profile has been removed for z80, z180, z80n.
- In 4.1.13, support for –profile has been removed.
- In 4.1.14, the gbz80 port was renamed to sm83.
- In 4.2.3, support for non-parenthesized arguments to __using and __interrupt was dropped.
- In 4.2.3, support for non-parenthesized arguments to __at that are not constants was dropped.
- In 4.2.4, the placement of __at in declarations was restricted.
- In 4.2.6, bool is chosen as the underlying integer type for enumerations with just two values.
- In 4.2.9, support for –pedantic-parse-number and #pragma pedantic_parse_numer was dropped.
- In 4.2.9 support for arguments to -MMD was dropped. The output fiel can be specified via -MF instead.
- In 4.2.10, _sdcc_external_startup was renamed to __sdcc_external_startup and support for it was added to further ports.
- In 4.2.13, for the sm83 port, __sfr addresses need to be specified using the full 16-bit address.
- In 4.2.14, byte order in output from the %p specifier of printf()-family functions was corrected for big-endian platforms (stm8, hc08, s08, mos6502) to match uintptr_t.