Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!caip!princeton!allegra!ulysses!mhuxr!mhuxt!houxm!ihnp4!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP Newsgroups: net.lang.c Subject: Re: Compiler Specific Operators Message-ID: <1054@ttrdc.UUCP> Date: Sat, 12-Jul-86 20:32:25 EDT Article-I.D.: ttrdc.1054 Posted: Sat Jul 12 20:32:25 1986 Date-Received: Sun, 13-Jul-86 07:09:22 EDT References: <1825@uw-beaver> <2364@umcp-cs.UUCP> Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 41 In article <2364@umcp-cs.UUCP>, chris@umcp-cs.UUCP (Chris Torek) writes: > /* math.h */ > double _builtin_sin(double x); /* and the compiler version */ > #define sin(x) _builtin_sin(x) /* default to the compiler version */ >... >Note that this has some, er, `interesting' implications: > #include > double > subr(double (*fp)(double arg)) { > > return ((fp)(3.1415926535897932384626433832795));/* approx */ > } > strange() { > > ... subr(sin) ... /* NOW what? */ > } >This seems to call subr(_builtin_sin). The draft standard says that >because `sin' appears here without a following `(', it is not macro- >expanded; thus this in fact passes the address of the library function. If so, this is a "new" feature at least compared with AT&T SysV (could someone check out BSD and others?) C compilers, which give an error message about "argument mismatch" if something like this is tried. Given that this is supposed to be a "standard," I wonder what C compilers support this now? I thought standards were supposed to, er, be codifications of a combination of the best features in existing compilers, not invent things out of the blue sky... (isn't this the way the Fortran 66 and 77 standardizations worked, for example?). Not that treating macros this way is a bad idea, I just would like to know who does it now. >In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, vax135}!ttrdc!ttrda!levy