1

I am trying to print an unsigned long long value. I used printf and %llu. When I use cygwin on Windows 7, I get a value printed. When I do the same thing with cygwin on Windows Xp, I am getting a crash. Any ideas on how to get it printed.
Code Snippet

printf("%s: Initial endClock= %llu Line %d of %s\n",
                        __FUNCTION__,temp, __LINE__, __FILE__);  

Where temp is defined as unsigned long long

Also would like to know whether %llu is a standard part of c

Output of gcc -v is

gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) 
bobby
  • 2,629
  • 5
  • 30
  • 56
  • 2
    Can you post a code snippet that reproduces the crash on XP? – Eitan T Jul 26 '12 at 06:37
  • 1
    `unsigned long long` and the `%llu` format are standard from C99 on. gcc had them already before that. If your XP compiler is a C89 compiler, that wouldn't know the type or format, but I think Cygwin uses gcc, so that should have no problems with it. Can you give more details, compiler on XP, Cygwin version? – Daniel Fischer Jul 26 '12 at 12:25
  • To expand on Daniel's comment - please show the command line used to compile and show the output of `gcc -v`. I have a feeling you may be using MinGW, not Cygwin. If that's the case, this answer may explain what's going on: http://stackoverflow.com/a/7136886/12711 – Michael Burr Jul 26 '12 at 18:03
  • gcc 3.4.4 was released in 2005. Your runtime is probably just as old. You might want consider updating your cygwin distribution. – Michael Burr Jul 27 '12 at 03:59
  • The same cygwin distribution runs on a Win7 machine without this problem. http://stackoverflow.com/questions/5997258/strange-unsigned-long-long-int-behaviour?lq=1 gave me the explanation I was looking for – bobby Jul 27 '12 at 04:14
  • I see - that seems to indicate that your version of cygwin uses the MSVCRT.DLL runtime to some degree. I don't think that's true anymore, but I'm not too familiar with the ins and outs of cygwin. – Michael Burr Jul 27 '12 at 04:30
  • It does, because the segmentation fault had the following trace 0x77c42a16 in wscanf () from /cygdrive/c/WINDOWS/system32/msvcrt.dll – bobby Jul 27 '12 at 05:06

0 Answers0