Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Order of member initialization
Re: Order of member initialization [message #58896 is a reply to message #58895] Fri, 23 September 2022 00:53 Go to previous messageGo to previous message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 220
Registered: June 2011
Experienced Member
peterh wrote on Fri, 23 September 2022 00:26

Oh my god, I am german spoken and this is hard to understand in english.
The DeepL transator, (which is usually very good) makes it completely confused.

I hope this translates to this semantically:
1) A sequence point is a finalizing point where all preceding calculations and initializations are completely processed.
2) An initializer list is strictly evaluated from left to right, and each bracketed initializer term ends with a sequencing point.

I hope I am not in error ; (I hope and assume this, because it makes some sense for me)


No kidding, it's pretty hard to follow the whole thing, but your understanding agrees with my own. But I'm left with other questions.
It says "brace-enclosed", so I wonder if paren-enclosed follow the member order in the class still. The other thing I wonder about is if it also applies to brace-enclosed designated initializers e.g.

a = {
  .b = 1,
  .c = 2,
  .d = 3
};


One might ask where the problem comes from, so here's a pathological example:

a = {
  .b = 1,
  .c = 2,
  .d = a.b
};


The compiler might let you get away with that, but from what I'm told it's undefined behavior.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Can TheIDE be used in two instances?
Next Topic: Some Questions
Goto Forum:
  


Current Time: Thu May 09 02:10:58 CEST 2024

Total time taken to generate the page: 0.02624 seconds