X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=4.4 required=5.0 tests=AWL,BAYES_50 X-Spam-Check-By: sourceware.org Date: Sat, 29 Dec 2012 08:54:02 +0100 From: Arno Wagner To: cygwin AT cygwin DOT com Subject: format specifier for long long incompatible to glibc Message-ID: <20121229075402.GA23880@tansi.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, 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. Example: #include 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); } gives: 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. Versions: cygwin libc: No idea, which package is that thing in? Installed 12/2012 though, so pretty new. cygwin gcc: 4.5.3 Arno -- Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno AT wagner DOT name 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: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple