Date: Thu, 18 Mar 1999 07:07:23 +1000 From: Greg Black <gjb@comkey.com.au> To: spinner.rflab@t-online.de (Steffen Hein) Cc: freebsd-questions@FreeBSD.ORG Subject: Re: gnu C compiler Message-ID: <19990317210724.9018.qmail@alpha.comkey.com.au> In-Reply-To: <36EFA9ED.5126E95C@t-online.de> of Wed, 17 Mar 1999 13:11:09 GMT References: <36EFA9ED.5126E95C@t-online.de>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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 ? No idea about Linux, but your program is wrong so any results are legitimate. > Compiling the following program 'proto.c' in FreeBSD and in Linux as > # cc -ansi proto.c -o proto.a Learn to use gcc's warnings (at the very least -Wall), and you'll see where your code is incorrect. I've snipped most of this code, but there are several other poor C coding practices not related to the stated problem which should also be addressed. Further help can be obtained from good books and places like comp.lang.c, since C coding is not really a topic for freebsd-questions. > printf( "\n\n FLT_MIN = % le ", FLT_MIN); ^ This is wrong ----------------------^ Leave out the `l'. It's not correct for the `e' conversion. > 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> 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?19990317210724.9018.qmail>