Code Generation (register byte, short...)
Laura Creighton
laura at l5.uucp
Thu Nov 28 03:27:04 AEST 1985
In article <703 at petrus.UUCP> hammond at petrus.UUCP (Rich A. Hammond) writes:
>
>The problem is really the brain damage among UNIX hackers that assumes
>sizeof(int) == sizeof (char *). This is so painful to fix (for quick ports)
>that although the 68000's int should be 16 bits (the size that works best,
>fastest, ...) it is often made 32 bits. While this avoids the pain for the
>porter, it does lead to problems for the end user (i.e. using short vs int).
>
Unless you intend to do a lot of multiplying and dividing, I can't see what
you would gain in making ints 16 bits. You *won't* get a significantly
faster port, because you have to go through all the code and check for
(at a minimum) dereferencing null pointers, and while you are at that you
can get those as well.
A harder problem is code that assumes sizeof(int *) == sizeof(char *)
== sizeof(struct foo *). Use lint. realise that correct code is not just code
that happens to not dump core very often on your machine. Use lint.
--
Laura Creighton
sun!l5!laura (that is ell-five, not fifteen)
l5!laura at lll-crg.arpa
More information about the Comp.lang.c
mailing list