This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

format specifier for long long incompatible to glibc


I found some old messages about this on the mailing list (from 2004) 
and since I really do not know what glibc allowed back then, I 
thought I should report this as an incompatibility.

cygwin (current version) allows only 'll' and 'q' (undocumented but
works) as specifier for long long int, while glibc allows 'll', 'L', 
and 'q'. Unfortunately, even gcc -Wall does not give a warning (and 
I did not find any other warning option that would apply) when
using 'L', it just silently (!) cuts the long long down to 32 bit.


#include <stdio.h>

void main() {
  long long i;

  i = 10000000000L;

  printf("sizeof long long: %d\n", sizeof(i));
  printf("L specifier:  %12Ld\n", i);
  printf("q specifier:  %12qd\n", i);
  printf("ll specifier: %12lld\n", i);


sizeof long long: 8
L specifier:    1410065408
q specifier:   10000000000
ll specifier:  10000000000

I think this should be fixed, as it may really mess up things
and, to make matters worse, only shows up when the argument exceeds 
the integer value limits, making it potentially hard to find.

  cygwin libc:   No idea, which package is that thing in? 
                 Installed 12/2012 though, so pretty new.
  cygwin gcc:    4.5.3

Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email:
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
One of the painful things about our time is that those who feel certainty
are stupid, and those with any imagination and understanding are filled
with doubt and indecision. -- Bertrand Russell

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]