<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/13 Sebastian Redl <span dir="ltr"><<a href="mailto:sebastian.redl@getdesigned.at" target="_blank">sebastian.redl@getdesigned.at</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On 2013-12-13 13:56, Andrzej Krzemienski wrote:<br>
><br>
> There is no harm, except that this is defined as UB. Could the rule be<br>
> relaxed to say that if the derived type is layout-compatible with the<br>
> base class and its destructor is implicitly declared or explicitly<br>
> defaulted, the behaviur is well defined?<br></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
</div>This would turn a rather simple rule...</blockquote><div><br></div><div>Yes, I am proposing a more complex rule.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
You're not getting rid of a category of undefined behavior. </blockquote><div><br></div><div>Correct. And that is not my goal.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This is fragile.</blockquote><div><br></div><div>Now it is all UB. Is it not fragile already? <br> <br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<div>It's hard to teach. <br></div></blockquote><div><br></div><div>I do not expect that this thing I am proposing would be taught. What you would teach people doesn't change: use virtual or protected destructors in base classes. This thing would be only exploited by programmers that feel they know what they are doing -- at their own risk.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
the simpler rule is just better by virtue of being simpler.<br></blockquote><div><br></div><div>True.<br><br></div><div>Regards,<br></div><div>&rzej<br></div><div> </div></div><br></div></div>