sizeof
Norman Diamond
ndiamond at watdaisy.UUCP
Tue Feb 12 06:11:29 AEST 1985
> I don't have difficulty with it [various sizes of pointers], but I do
> feel that all pointers should be the same size. A pointer is a pointer,
> regardless of what it points to. It's a datatype all by itself; it isn't
> a mutation of the datatype it points to.
>
> Perhaps an addition to the language is in order (gotta have something to
> handle those Intel chips). Well, since C allows you to have 'long int',
> 'int' and 'short int', what about long pointers, pointers and short pointers?
> Don't ask me how they would be declared; I'll leave that up to someone
> else.
> -- Robert Viduya
Then no one will know when to declare a long pointer or short pointer.
They know they need a (struct xxx *) or a (char *), they should have a
compiler that's bright enough to figure out whether a long pointer or
short pointer is needed, for each machine they want to run their program
on.
In PL/I, a pointer is a datatype all by itself. On some machines, in
order to be able to "point" to either integers or characters, you have
to waste 3/4 of the memory your strings are stored in, and you can't use
the machine's string instructions.
On Intel, you can make all pointers the same size by using long pointers
for everything, whether they're needed or not. Or, you can use a language
that has a little bit of flexibility, and lets the compiler figure out
such things.
These are the reasons that Pascal, despite all of its shortcomings, is
more portable in some ways than C is.
People in net.lang.pascal are complaining about the same things, not being
able to assign pointers to ints. Sure, let's reduce the portability of
every existing language, and give more jobs to portability and languages
people so that they can repeat the cycle, eh?
--
Norman Diamond
UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy at waterloo.csnet
ARPA: ndiamond%watdaisy%waterloo.csnet at csnet-relay.arpa
"Opinions are those of the keyboard, and do not reflect on me or higher-ups."
More information about the Comp.lang.c
mailing list