Expressions in initializers

Dave P. Schaumann dave at cs.arizona.edu
Wed Mar 6 09:00:48 AEST 1991


In article <3599.27d3ca8a at iccgcc.decnet.ab.com> browns at iccgcc.decnet.ab.com (Stan Brown) writes:
|In article <1032 at caslon.cs.arizona.edu>, dave at cs.arizona.edu (Dave P. Schaumann) writes:
|| First thing you need to realize is that there is no special, pre-defined
|| function sqrt() in C.  [more embarassing comments deleted :-/ ]

|This was my thought at first, and it's certainly true for non-ANSI compilers.
|
|But App. F.2 of the ANSI standard says undefined behavior results "if the 
|program redefines a reserved external identifier (4.1.2)."
|[...]
|So 'sqrt' is a reserved identifier with external linkage, and behavior
|is undefined if the user redefined the 'sqrt' identifier by providing
|her own sqqrt function.

Ok, ok, OK!!!  I was wrong.  I know it now.  I spoke from experience with
the pre-standard C.  I guess I really need to take a close look at K&R2 to
see what other suprises are lurking for me there...

That aside, the logical conclusion of "constant" evaluation at compile-time
will make C compiler into a C interpreter as well.  I have been reminded in
the past that C is supposed to be a small language (when wishing for a
largest-of operator on enums).  Think how much more work the compiler must
do to evaluate constant-parameter functions at compile time, even if you
limited this to standard library functions.

Can you say "creeping featurism?"  Can you say "kitchen sink?"
Sure!  I knew you could...

-- 
		Dave Schaumann		dave at cs.arizona.edu
'Dog Gang'!  Where do they get off calling us the 'Dog Gang'?  I'm beginning to
think the party's over.  I'm beginning to think maybe we don't need a dog.  Or
maybe we need a *new* dog.  Or maybe we need a *cat*! - Amazing Stories



More information about the Comp.lang.c mailing list