C bug causes double fault

Jonathan Ballard asmodeus at tree.UUCP
Wed Mar 22 06:32:29 AEST 1989


In article <9884 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
> In article <244 at tree.UUCP> zarquon at tree.UUCP (Erin Filbert) writes:
> >main()
> >{
> >	float x;
> >	printf("x = %d", x);
> >}
> 
> You'll undoubtedly get a flood of responses correctly pointing out
> that conversion of a double (promoted float) argument according to
> an int format is incorrect.  Use %g or some such format specifier.

Okay, of course it is a bug.  But the problem is that cc is not detecting
it and just compiles it that way.  Shouldn't there be something in cc so
that a warning could appear.  Say like:

WARNING! Float not casted in to different declaration.

This is actually a serious error because anybody could do this and then
totally crash the system! 
-- 
----Asmodeus - Jonathan Ballard  ..!csusac!tree!asmodeus
				 ..!pacbell!sactoh0!tree!asmodeus
"I'm going to create the best game ever heard of!
	Might take a few years thou..." -me



More information about the Comp.unix.questions mailing list