Arcane C hacks?

KW Heuer kwh at bentley.UUCP
Sun Feb 23 10:37:43 AEST 1986


In articles <184 at bu-cs.UUCP> bu-cs!bzs (Barry Shein) writes:
>declare a table something like:   int (*funtable[MAXFNS])() ;
>and just malloc the storage for the generated code.  ...  It should be
>quite portable (code generator aside) and is legal C.

Well, some compilers will dislike the attempt to cast a (char *) into
a (int (*)()) ; in fact I think some will call it an outright error
(not just a warning).  But in any case it is _not_ portable to the 3b2,
because all programs are pure -- you can't goto/call data space, nor
can you read from the instruction stream.  Some sort of chastity belt
in the hardware, I think.



More information about the Comp.lang.c mailing list