call to revolt

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Wed Jun 26 19:02:53 AEST 1991


In article <rabson.677868220 at physics.ubc.ca>, rabson at physics.ubc.ca (David Rabson) writes:
> Outlawing lvalue casts, however, borders on fascism.  I have yet to see
> a pre-ansi compiler that fails to treat properly
> 
> 		void *thing;
> 		((int *)thing)++;
> 
> (or, if it doesn't know about voids, the same thing with char *thing).

Funny thing, I've been using C since V6+ UNIX (1979), and I have never
ever had any reason to use one of these things.  If you really want to
accomplish the probable intended effect of that,
	thing = (void*)(1+(int*)thing);
is legal, is it not?

> I hereby invite the black-shirts from the ansi camp to explain their
> prejudice against casting lvalues.

It was never part of the language, and this is an area where X3J11
chose not to innovate.

If you're going to moan about things which were never explicitly legal
vanishing, how about my old favourite?  Labels used to be usable as
constants of type char*, so I could pass a label in a C function to an
assembly-coded function.  Great for speeding up threaded-code.  But
did the ANSI committee support that lovely old hack?  No. Sob sob sob.
Do I call them "black-shirts" for this?  No.

> The rest of us should stop sitting back and start fighting.  If enough
> customers insist on casting lvalues and otherwising ignoring ansi's
> meddling in Kernighan's and Ritchie's work, vendors will create
> correct, rather than compliant, compilers.

It's attitudes like this that make me think about switching to Ada.

-- 
I agree with Jim Giles about many of the deficiencies of present UNIX.



More information about the Comp.std.c mailing list