Date: Fri, 19 Mar 1999 12:30:41 +0000 From: spinner.rflab@t-online.de (Steffen Hein) To: freebsd-questions@FreeBSD.ORG Subject: Re: gnu C compiler Message-ID: <36F24371.37ACAF58@t-online.de> References: <36EFA9ED.5126E95C@t-online.de> <19990317210724.9018.qmail@alpha.comkey.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Steffen Hein wrote: > > > How can you explain me that the same gnu C compiler ( release 2.7.2.1 ) > > in FreeBSD apparently does not handle the long double format correctly > > while in Linux it does ? Greg Black wrote: > > Learn to use gcc's warnings (at the very least -Wall), and > you'll see where your code is incorrect. > printf( "\n LDBL_MIN = % Le ", LDBL_MIN ); > > This is wrong, as gcc would have told you with -Wall: you are > passing a `double' to printf() but telling it you are passing a > `long double'. If you lie to the compiler, then it will get its > revenge. > > If you cast LDBL_MIN and friends to the correct type, then your > program will run to completion. > > -- > Greg Black <gjb@acm.org> The comment merely states that the gnu C compiler does not comply here with the ANSI standard, according to which the format instructions are legitimate. ( Cf. chapter 'The ANSI Runtime Library' in Darnell & Margolis, ISBN 0-387-97389-3, p.453, Springer ) - At any rate, Linux cooperates correctly. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36F24371.37ACAF58>