Address of array

Bennett E. Todd III bet at ecsvax.UUCP
Thu Mar 20 04:48:58 AEST 1986


I agree that the inconsistancy between array name semantics and
structure name semantics is unfortunate. The extensions of structure
assignment, parameter passing by value, and returning by value, are
distasteful. Aggregates, both arrays and structures, should not be
"automagically" copied around by the compiler; instances of their names
as rvalues without explicit dereferencing should be converted to
pointers in BOTH cases. Note that (re)establishing the notion that a
structure name evaluates to a constant pointer to that structure removes
the distinction between the "." and "->" operators for structure member
dereference, which removes a popular source of subtle portability bugs
(to and from compilers that use the old, simpler semantics). D. Gary
Grady (dgary at ecsvax.UUCP) just pointed this out to me, and added that
this frees up the operator "->", which we could use for longjmp:-)

While I'm yapping about the big steps backward that C has made, let me
add the tightening up of the semantics of "goto", making jump tables
impossible. Switch statements are ideal for some things; not for
everything. If you want to construct efficient finite state automata you
need a jump table, without the frills forced on you by the semantics of
the switch statement. Let "label" be a new reserved word, for a new data
type, not convertable to any other. Let labels in code of the form
"<name>:" be constants of type label (and have the compiler do forward
referencing correctly, either with multiple passes or with
backpatching). Let me declare constant, initialized arrays of type
label. Grrhhh. Have to write my own compiler. Grrhhh. Let's call the new
language "C--".

-Bennett
-- 

Bennett Todd -- Duke Computation Center, Durham, NC 27706-7756; (919) 684-3695
UUCP: ...{decvax,seismo,philabs,ihnp4,akgua}!mcnc!ecsvax!duccpc!bet



More information about the Comp.lang.c mailing list