Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!cbmvax!snark!eric From: eric@snark.UUCP (Eric S. Raymond) Newsgroups: comp.lang.c++ Subject: Re: C++ enhancements Message-ID: <2249424b:4311@snark.UUCP> Date: 24 Mar 88 17:07:14 GMT References: <2781@mmintl.UUCP> Organization: Thyrsus Enterprises, Malvern PA 19355 Lines: 55 Summary: Why not 'leaf' as a pragma? In article <7757@alice.UUCP>, bs@alice.UUCP writes: > [Replying to Frank Adams] > > Add a new keyword "leaf" to the language... >I think that this is unnecessary: I don't think your agendas are incompatible. Why not add 'leaf' as a pragma? I'll state this as a more general proposed rule for the 'what should we hack into C++ next' game: OPTIMIZATION HINTS SHOULD BE PROPOSED AS OPTIONAL PRAGMAS, IF AT ALL This way they don't clutter up the language structure. And no, scope is not a problem. If you view the action of #pragma leaf as 'set a compiler flag that affects processing of the next declaration' the scope is set by, of course, the next declaration. This approach generalizes. If X3J11 ever gets its collective head out of its collective asshole about 'noalias', they'll turn it into a collection of pragmas. As dmr has observed, it doesn't designate an object property and doesn't belong in declarations (I actually agree with his stronger claim that it doesn't belong in the language at all but that's a separate issue from the one I'm addressing here). Note: Despite the fact that I am fed up enough with the X3J11 committee to get extremely rude at them as above, I sincerely do *not* intend insult to any individual X3J11 member and do respect the good work the committee has done in the past. Committees are strange beasts with lives of their own (who wrote that line about the intelligence of a committee being the lowest of its members' intelligences divided by the number of members?). But I *still* want to know what happened to the "no prior art" exclusion...] In general I don't think optimization hints should be embedded in HLL designs because they aren't part of the abstract semantics that HLLs are designed to describe (cf. FORTRAN's FREQUENCY statement). Granted there are borderline cases (Pascal's 'pure' is one that I've been friendly to having *in the HLL itself* during moments of weakness, and a properly-defined relative of 'noalias' might be another tempter). But the *presumption* that things like 'leaf' deserve first-class citizenship in a language, rather than being things you might want to tell the compiler about how to translate some pieces of the code some of the time, is clearly wrong. Discussion should *start* with "Hey, howzabout '#pragma leaf'...". and go to 'keyword leaf' only if (as Bjarne pointed out) we're talking about a usage constraint rather than a simple performance booster. -- Eric S. Raymond (the mad mastermind of TMN-Netnews) UUCP: {{uunet,rutgers,ihnp4}!cbmvax,rutgers!vu-vlsi}!snark!eric Post: 22 South Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718