More bugs?

utzoo!decvax!cwruecmp!harr utzoo!decvax!cwruecmp!harr
Thu Jan 27 15:51:08 AEST 1983


 It seems all the bugs (features, ?) are coming out so I thought I might relay
what I found a couple of weeks ago.  I do not claim the following to be
"good" code or "Portable" but it was the only solution to a problem I had.

	proc1 (name, value)
	short	name;
	float	value;
	{
		...
		proc2 (sizeof(name), &name, sizeof(value), &value);
		...
	}

Now we all know arguments to procedures are passed as either doubles
or longs (or pointers).  The call to "proc2" is as follows:

	proc2 (2, ptr_to_short, 8, ptr_to_double)

Leaving the float (value) as a double is possibly understandable, but then
the short (name) should have been left as a long.  The two were treated in
a different manner.  This compiled in this form independent of the optimizer.



More information about the Comp.lang.c mailing list