Questions on X3J11 draft

Henry Spencer henry at utzoo.UUCP
Fri Dec 5 04:32:30 AEST 1986


> 1) What is the unary plus operator I've heard ?  Is it an attempt
> to force ordering in expression evaluation ? ...

Unary plus was introduced originally, as I understand it, for various
minor reasons.  (For example, "+204" is a valid number when read by
printf, but is illegal in a [pre-X3J11] C program, which seems undesirable.)
It has since been overloaded as an optimization fence, which I'm not keen
on.  I can see the desirability of such a fence; splitting up expressions
and evaluating the pieces separately can be a major pain, and makes code
much harder to read.  I can't say as I like unary plus as the syntax for
the fence, though.

> 2) Can I do something like this:
> 
> #define ABC=100

No, not with the semantics you obviously are thinking of.  Why would you
want to?  That is not C, and never has been.  It might perhaps be the right
way to do it if one were designing a new language, but that's not the issue
at hand.

> 3) Can I do something like this:
> 
> char a[sizeof(struct name *)0->element];

Don't think so.  Have you considered determining the type of "element" and
saying "char a[sizeof(the_type)]"?  It is agreed that this would be a bit
simpler with a "typeof" operator, but it's not a disaster even so; at worst
it means an extra macro or typedef to give the type a name of its own.

> 4) Are there provisions for future modifications to the standard?

I believe all ANSI standards have provisions for future review.  The people
who do these things are not idiots.

> 5) Has any attempt been made to see what percentage of existing
> code (say at AT&T or wherever) would break under the X3J11 draft?

I suspect AT&T has been paying close attention to this, although I don't
know of any actual numbers.  The intent all along has been that existing
*legal* code will not break.

> 6) On a more philosophical note, I object to the use of the name
> C for the language.  Unless Dennis Ritchie has said he doesn't
> mind...

Dennis has been involved with X3J11, although not deeply; last I heard,
he approved.  I know he liked the idea of someone else taking over the
role of ultimate authority on C.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,decvax,pyramid}!utzoo!henry



More information about the Comp.lang.c mailing list