"Numerical Recipes in C" is nonportable code

Henry Spencer henry at utzoo.uucp
Sun Sep 18 07:09:15 AEST 1988


In article <5514 at eagle.ukc.ac.uk> mtr at arthur.UUCP (M.T.Russell) writes:
>	union foo {
>		char *data;
>		int (*func)();
>	};
>
>The compiler would either have to prohibit unions with both text and
>data pointers or do runtime bookkeeping to remember what was last
>stored in such unions.

No, it is sufficient if any attempt to use this trick malfunctions badly.
(For example, if the two kinds of pointers are not the same size, it is
almost guaranteed to.)
-- 
NASA is into artificial        |     Henry Spencer at U of Toronto Zoology
stupidity.  - Jerry Pournelle  | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list