Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!apple!uokmax!occrsh!fang!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Re: conditional scope and destructors results Summary: Yes, but how good is good? How high is up? Message-ID: <449@mole-end.UUCP> Date: 1 Dec 90 08:36:11 GMT References: <1990Nov13.114958.20853@hemel.bull.co.uk> <329@tin.crc.ac.uk> <1990Nov28.191327.8778@Neon.Stanford.EDU> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 42 > > [Ellis and Stroustrup] say it is illegal to jump forward past an > > initializer -- not that it is illegal to write code that might permit > > a jump past an initializer. . . . > > I would suspect that smart compilers would cause a compiler time error > > if it can be assuredly determined that a constructor is being by-passed ... > Maybe this is impossible to do in general, but it should be possible to > use a conservative strategy. For example, cfront 2.0 throws out the following > int i=1; > if (i!=1) goto L123; > float x=0.0; > L123: > even though the goto will never be executed. There's a case for tightening > up the wording, but I believe the responsibility for detecting potential > errors of this kind should rest with the compiler, even if it occasionally > results in minor inconvenience (through the adoption of a conservative > strategy). There's a real problem with this real nice idea, to wit, what defines the algorithm that determines whether or not the compiler can `assuredly determine' that the declaration will never be elaborated? What strict, unambiguous, standard-suitable definition is to be found for the criteria against which a piece of code is to be tested? Will such a definition be USEFUL to the ordinary Sue, Ann, and Cheryl who are programming in C++? Would it be useful to the maintenance programmer who inadvertantly broke a flow-control assumption on which depended the correctness of some remote piece of code? Some of the answers might be acceptible if there were a well enough developed body of computing theory. In fact, little or none of our present computing theories can give us a good language with which to talk about this problem. -- (This man's opinions are his own.) From mole-end Mark Terribile Brought to you by Super Global Mega Corp .com