olcott <NoOne@NoWhere.com>: Sep 29 04:38PM -0500 On 9/29/2020 3:54 PM, David Brown wrote: >>> Sorry, but no. The standard says in [class.base.init]: "Then, >>> non-static data members are initialized in the order they were >>> declared in the class definition I proved that the constructor can force the initialization order to be different than the order they were declared in the class definition. -- Copyright 2020 Pete Olcott |
David Brown <david.brown@hesbynett.no>: Sep 29 11:53PM +0200 On 29/09/2020 23:38, olcott wrote: >>>> declared in the class definition > I proved that the constructor can force the initialization order to be > different than the order they were declared in the class definition. I believe you misunderstand me. /Logically/ the constructor body can specify a different order than the class definition (though the body provides assignments, not initialisations - there is a difference). But if the statements in the body are simple assignments like the ones above, or even some function calls, then the compiler can re-arrange them because there is no (defined) way for the program to see a difference. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment