Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!news.cs.indiana.edu!arizona.edu!arizona!dave From: dave@cs.arizona.edu (Dave P. Schaumann) Newsgroups: comp.lang.c Subject: Re: Expressions in initializers Message-ID: <1043@caslon.cs.arizona.edu> Date: 5 Mar 91 23:00:48 GMT References: <17270@crdgw1.crd.ge.com> <760@ajpo.sei.cmu.edu> <1991Mar4.144939.8311@ux1.cso.uiuc.edu> <1032@caslon.cs.arizona.edu> <3599.27d3ca8a@iccgcc.decnet.ab.com> Organization: U of Arizona CS Dept, Tucson Lines: 33 In article <3599.27d3ca8a@iccgcc.decnet.ab.com> browns@iccgcc.decnet.ab.com (Stan Brown) writes: |In article <1032@caslon.cs.arizona.edu>, dave@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@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