On Wed, 2008-01-23 at 11:58 -0500, Swaroop Sridhar wrote: > Is the condition is same as saying `p' must never be used as an > rvalue before being initialized? This condition is certainly sufficient.
Yes. > The checking algorithm can be simple or complex based on how "visibly" p > is initialized. > > That is, p could be initialized by: > > i) Straight line code before use (trivial to check). > ii) Initialized differently in different branches of conditionals (this > is also easy to check, but I am not sure if it is necessary in a > constructor). I suspect this is necessary. > iii) p might be passed by reference (note that this is not really an > rvalue usage) to another function that initializes it. (this is > hard to check in general). Concur. However, it occurs to me that this can be handled by inferred type. Specifically, we can introduce a type qualifier on by-reference arguments. For the sake of discussion, I will call this PREINIT. Given an argument of type PREINIT BY-REF T arg the contract is that (1) the formal parameter arg is guaranteed to be initialized before use within the body of the procedure, and (2) the formal paramter arg is guaranteed to be initialized by any exit or escape path from the procedure (including exceptional escape). However, I do not believe that this degree of complication is likely to be necessary. shap _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
