kwh@bentley.UUCP (KW Heuer) (04/16/86)
In article <4017@pur-ee.UUCP> pur-ee!pasm (PASM Parallel Processing Laboratory) writes: > but you can just as correctly write: > sizeof int I've seen compilers that will accept this, but I believe K&R says the parens are necessary when the argument is a datatype (to avoid the ambiguity of e.g. "sizeof char * - 1"). > What the heck is a compile-time function? Real useful - > functions that return constants. Come on now. I can think of two cases, off the top of my head, where a compile-time function makes sense: double log10(x) double x; { return log(x)/log(10.0); } char buf[max(XSIZE,YSIZE)]; It's more efficient for log(10.0) to be evaluated at compile-time, and it's essential for the compiler to know the constant result of max(). In practice, of course, these are handled by a preprocessor constant (for the specific value LOG10 or its reciprocal) and a macro implementation of max (which unfortunately can't also be used as a function in general -- this is a potential argument in favor of builtins?). Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint
cdshaw@watdragon.UUCP (Chris Shaw) (04/28/86)
This discussion is getting really boring. (Yes I know I can "n" past them, but that's not the point). Could people who have a burning desire to talk this to death please stop (or do so by mail) ? I'm getting rather sick of sizeof blah. Chris Shaw watmath!watrose!cdshaw or cdshaw@watmath University of Waterloo Bogus as HELL !!!