Originally Posted by
swoopy
Well, maybe not the same compiler. cygwin gcc is probably more like the unix version. Would that be correct?
I don't have any insight into the differences. With the dev-cpp compiler, gcc --version gives this:
gcc (GCC) 3.3.1 (mingw special 20030804-1)
With cygwin's gcc I get this:
gcc (GCC) 3.3.3 (cygwin special)
I was thinking maybe different library versions.
In the <inttypes.h> for dev-cpp it says, for example:
Code:
#define PRIu64 "I64u"
In <inttypes.h> for cygwin, it says
Code:
#define PRIu64 "llu"
Anyhow, using the data types from <stdint.h> and format specifiers from <inttypes.h> we at least have portability among these two C compilers.
[edit]
Forgot to mention: My examples also work on my Linux Fedora 3 Box
gcc --version gives this:
gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
And <inttypes.h> has stuff like this:
Code:
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
# else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
# endif
# define PRIu64 __PRI64_PREFIX "u"
# define PRIx64 __PRI64_PREFIX "x"
(The Linux version also works with %ll, obviously.)
[/edit]
Regards,
Dave