[comp.lang.c] Loopholes

franka@mmintl.UUCP (Frank Adams) (01/08/87)

In article <10849@sun.uucp> guy@gorodish.UUCP writes:
>I guess either not enough compilers are clever enough, so they want to use
>something like Mesa's "LOOPHOLE" operator, which merely reinterprets a
>bucket of bits.  It's interesting to note that C lacks this operator, while
>some languages with stronger type checking have it.

This isn't surprising.  Generally speaking, the stronger the type checking,
the more need there is for this kind of operator -- especially if you want
to do systems-type programming with it.

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Multimate International    52 Oakland Ave North    E. Hartford, CT 06108

guy%gorodish@Sun.COM (Guy Harris) (01/12/87)

> This isn't surprising.  Generally speaking, the stronger the type checking,
> the more need there is for this kind of operator -- especially if you want
> to do systems-type programming with it.

In some cases there are things you can't do in C without such an operator.
For example, if you have a "register" variable of some type, and you want to
interpret its bits as a value of some other type, you can't use the

	*(something_else *)(&x)

trick.

The lack of such an operator in C might not be surprising; it is amusing,
though, that there are grungy low-level non-portable things that can be
expressed in a language with more strongly checked types than C's, but not
in C.