Strange Errors with Python-2.2.2

Erik Max Francis max at alcyone.com
Sun Dec 22 18:20:41 EST 2002


lemonite wrote:

	...
>         printf("fractional part = %f\ninteger part = %f\n",
>                                         modf(x, &y), y);
	...
> The expected output should look like this:

There is no expected output, since you're invoking unspecified behavior.
C does not put any restrictions on the order in which arguments are
evaluated; by all rights an implementation could evaluate the y argument
first (which would evaluate to some indeterminate number since you
didn't initialize y), and then evaluate the modf expression.

When the order in which things get evaluated matters, don't put them in
function call arguments.  This is just operator error, not a gcc bug.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ God will forgive me; that's his business.
\__/ Heinrich Heine
    Maths reference / http://www.alcyone.com/max/reference/maths/
 A mathematics reference.



More information about the Python-list mailing list