From: Christophe VG <con...@ch...> - 2013-11-12 23:31:50
|
Hello, while getting sdcc up and running for a new project, I stumbled upon the following. $ cat minimal.c typedef unsigned long long QWORD; // 64-bit unsigned typedef signed long long LONGLONG; // 64-bit signed void main(void) { } $ sdcc minimal.c minimal.c:1: error 206: invalid combination of short / long minimal.c:2: error 206: invalid combination of short / long $ sdcc --version SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.3.0 #8604 (Nov 12 2013) (Mac OS X x86_64) Although I on the homepage I do read that sdcc’s features include: "basic (no integer constants) support for long long (64 bit, 8 bytes) data types for the z80, z180, r2k, r3ka, gbz80, hc08 and s08 targets.” Sorry, if I’m not seeing the elephant in the room here :-) Thanks for helping out in advance, regards, Christophe VG |
From: Philipp K. K. <pk...@sp...> - 2013-11-13 00:03:34
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 12.11.2013 23:29, schrieb Christophe VG: > Hello, > > while getting sdcc up and running for a new project, I stumbled > upon the following. > > $ cat minimal.c typedef unsigned long long QWORD; // 64-bit > unsigned typedef signed long long LONGLONG; // 64-bit signed > > void main(void) { } > > $ sdcc minimal.c minimal.c:1: error 206: invalid combination of > short / long minimal.c:2: error 206: invalid combination of short / > long > > $ sdcc --version SDCC : > mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 > 3.3.0 #8604 (Nov 12 2013) (Mac OS X x86_64) > > Although I on the homepage I do read that sdcc’s features include: > "basic (no integer constants) support for long long (64 bit, 8 > bytes) data types for the z80, z180, r2k, r3ka, gbz80, hc08 and s08 > targets.” > > Sorry, if I’m not seeing the elephant in the room here :-) Thanks > for helping out in advance, regards, Christophe VG sdcc minimal.c will compile minimal.c interpreted as source code written in the C89 dialect sdcc uses by default for the mcs51 target. long long was introduced in C99, and is thus not allowed in C89 (and the C89 dialect sdcc uses by default). AFAIK the mcs51 target does not support long long. You need to compile using a C standard that has long long and for a target that supports it, e.g. sdcc --std-c99 -mz80 minimal.c Philipp P.S.: Even though not mentioned on the homepage, the tlcs90 and stm8 targets support long long, too. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iEYEARECAAYFAlKCwcUACgkQbtUV+xsoLprFdgCePrL6IPCjyftWTBbTCw5sUTO/ rosAoJTo5pW4JQmOjSS/ex3nEvc9kHep =jesI -----END PGP SIGNATURE----- |
From: Christophe VG <con...@ch...> - 2013-11-13 13:09:07
|
On 13 Nov 2013, at 01:03, Philipp Klaus Krause <pk...@sp...> wrote: > Am 12.11.2013 23:29, schrieb Christophe VG: >> Hello, >> >> while getting sdcc up and running for a new project, I stumbled >> upon the following. >> >> $ cat minimal.c typedef unsigned long long QWORD; // 64-bit >> unsigned typedef signed long long LONGLONG; // 64-bit signed >> >> void main(void) { } >> >> $ sdcc minimal.c minimal.c:1: error 206: invalid combination of >> short / long minimal.c:2: error 206: invalid combination of short / >> long >> >> $ sdcc --version SDCC : >> mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 >> 3.3.0 #8604 (Nov 12 2013) (Mac OS X x86_64) >> >> Although I on the homepage I do read that sdcc’s features include: >> "basic (no integer constants) support for long long (64 bit, 8 >> bytes) data types for the z80, z180, r2k, r3ka, gbz80, hc08 and s08 >> targets.” >> >> Sorry, if I’m not seeing the elephant in the room here :-) Thanks >> for helping out in advance, regards, Christophe VG > > sdcc minimal.c > > will compile minimal.c interpreted as source code written in the C89 > dialect sdcc uses by default for the mcs51 target. > > long long was introduced in C99, and is thus not allowed in C89 (and > the C89 dialect sdcc uses by default). AFAIK the mcs51 target does not > support long long. You need to compile using a C standard that has > long long and for a target that supports it, e.g. > > sdcc --std-c99 -mz80 minimal.c > > Philipp > > P.S.: Even though not mentioned on the homepage, the tlcs90 and stm8 > targets support long long, too. Philipp, first of all thank you very much for your swift and very clear reply. In the mean-time I had already downgraded my sdcc installation to 2.9.0 - I’m working on Mac OS X and use MacPorts to keep my system updated, 2.9.0 is the only alternative. To my surprise, this works without a hiccup: $ sdcc --version SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Nov 12 2013) (Mac OS X ppc) $ sdcc minimal.c $ ls minimal.* minimal.asm minimal.ihx minimal.lst minimal.mem minimal.rst minimal.c minimal.lnk minimal.map minimal.rel minimal.sym Should I now deduce that sdcc 2.9.0 follows the C99 standard ? And that the default target is one of the targets with long long support ? Thanks again for getting me up to speed with this new environment, regards, Christophe VG |
From: Philipp K. K. <pk...@sp...> - 2013-11-13 13:28:20
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 13.11.2013 14:09, schrieb Christophe VG: > > On 13 Nov 2013, at 01:03, Philipp Klaus Krause <pk...@sp...> > wrote: >> Am 12.11.2013 23:29, schrieb Christophe VG: >>> Hello, >>> >>> while getting sdcc up and running for a new project, I stumbled >>> upon the following. >>> >>> $ cat minimal.c typedef unsigned long long QWORD; // 64-bit >>> unsigned typedef signed long long LONGLONG; // 64-bit >>> signed >>> >>> void main(void) { } >>> >>> $ sdcc minimal.c minimal.c:1: error 206: invalid combination of >>> short / long minimal.c:2: error 206: invalid combination of >>> short / long >>> >>> $ sdcc --version SDCC : >>> mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 >>> >>> >>> 3.3.0 #8604 (Nov 12 2013) (Mac OS X x86_64) >>> >>> Although I on the homepage I do read that sdcc’s features >>> include: "basic (no integer constants) support for long long >>> (64 bit, 8 bytes) data types for the z80, z180, r2k, r3ka, >>> gbz80, hc08 and s08 targets.” >>> >>> Sorry, if I’m not seeing the elephant in the room here :-) >>> Thanks for helping out in advance, regards, Christophe VG >> >> sdcc minimal.c >> >> will compile minimal.c interpreted as source code written in the >> C89 dialect sdcc uses by default for the mcs51 target. >> >> long long was introduced in C99, and is thus not allowed in C89 >> (and the C89 dialect sdcc uses by default). AFAIK the mcs51 >> target does not support long long. You need to compile using a C >> standard that has long long and for a target that supports it, >> e.g. >> >> sdcc --std-c99 -mz80 minimal.c >> >> Philipp >> >> P.S.: Even though not mentioned on the homepage, the tlcs90 and >> stm8 targets support long long, too. > > Philipp, > > first of all thank you very much for your swift and very clear > reply. > > In the mean-time I had already downgraded my sdcc installation to > 2.9.0 - I’m working on Mac OS X and use MacPorts to keep my system > updated, 2.9.0 is the only alternative. To my surprise, this works > without a hiccup: > > $ sdcc --version SDCC : > mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 > 2.9.0 #5416 (Nov 12 2013) (Mac OS X ppc) > > $ sdcc minimal.c > > $ ls minimal.* minimal.asm minimal.ihx minimal.lst minimal.mem > minimal.rst minimal.c minimal.lnk minimal.map minimal.rel > minimal.sym > > Should I now deduce that sdcc 2.9.0 follows the C99 standard ? And > that the default target is one of the targets with long long > support ? > > Thanks again for getting me up to speed with this new environment, > regards, Christophe VG 2.9.0 is quite old, sdcc has improved a lot since. Support for long long was added after the 3.0.0 release, so 3.1.0 is the first release with support for long long. AFAIR, 2.9.0 had a bug that would result in sdcc accepting any number of "long", e.g. "long long", and "long long long". However they were all treated the same as long. Philipp -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iEYEARECAAYFAlKDfmIACgkQbtUV+xsoLppSXwCglPMmvs4iBJLRHEW49+Nptpgk E5MAnjNBkuyvBpA3rJ4FufqWA4PHvayr =ztlP -----END PGP SIGNATURE----- |