lint, pointers, 0 (what else?)

Ron Natalie <ron> ron at brl-tgr.ARPA
Mon Feb 11 13:19:55 AEST 1985


> 
> Looking at my assembly language programs, I find that I end up doing
> 95% of all operations with one data type: address (here meant to refer
> to the integer type that can hold an address, i.e. 32bits on a 68000).
> Maybe 4% are done with characters, and the remaining 1% with other
> types. I would be perfectly happy with a systems programming language
> that has only one data type: address.  Such languages exist and are
> moderately successful. Unfortunatly, they are not widely available in
> the UN*X world or on micros.
> 

You obvously don't work on a diverse enough collection of machines.
Some machines have readically different types of "address" depending on
the data type. However, several of the propositions by the C standards
will solve these problems.

The bottom line pointer (void *) can replace any need to try to stick
a pointer into an integer.  As you state, a lot of work is done handling
a type called "address."  Well (void *) is an attempt to implement this
witout warping the semantics of the language too much.  In addition, it
wouldn't require any needless restraints on what "int" is just because
pointers are an odd size on this machine.

The other problem involves the use of 0.  Legally you are supposed to
be able to assign the constant 0 to a pointer and compare a pointer to
zero.  But if you try to pass zero to a function expecting a pointer,
it gets passed as int.  The function argument typing will solve this
problem as well.

See, problem solved.  It's been solved, and these language features
were already fought over and accepted.

-Ron



More information about the Comp.lang.c mailing list