>> No, this is not a "critical potential error". It's not even an "error". >> It is a compiler *warning* (usually given by some old versions of >> Microsoft's Visual C++ compiler). > > I don't think VC++ is wholly wrong to warn about this. The object isn't > completely constructed when the initializer list is processed, but 'this' is > assumed to point to a constructed object. > > If all the parent ctor does with the value is hold it for use *after* all the > ctors run, it's fine.
Yes, and that is what we do. > If the base ctor dereferences the pointer, though, it's a potential bug. The only real danger is if the base-class constructor tries to access member fields in the derived class - but the only way that could really happen would be if the base-class constructor were to explicitly cast the pointer into that of the derived class, and then try to dereference it. Even calling a virtual function wouldn't cause a problem, because (being in a constructor) the base-class function would end up being called instead. So, IMHO, this (old) compiler is being a bit anal-retentive about issuing a warning here. In any case, it's not an 'error' at all. Ross Finlayson Live Networks, Inc. http://www.live555.com/
_______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel