<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><blockquote type="cite"><blockquote type="cite">No, this is not a "critical potential error". It's not even an "error".<br> It is a compiler *warning* (usually given by some old versions of<br>Microsoft's Visual C++ compiler).<br></blockquote><br>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.<br><br>If all the parent ctor does with the value is hold it for use *after* all the ctors run, it's fine.<br></blockquote><div><br></div>Yes, and that is what we do.</div><div><br></div><div><br><blockquote type="cite">If the base ctor dereferences the pointer, though, it's a potential bug.<br></blockquote><div><br></div>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.</div><div><br></div><div>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.</div><br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>