This outputs the same thing on all my compilers |
Sorry for the delay. Thanks a lot for the research. Then the compiler vendors are consistent. But IMO it is not yet standard. It appears to be common fact, so thanks for the info.
Recently my attention was drawn to some upcoming standard ratification - string c_str function will have constant time complexity. Apparently, that must have been a fact already for many major compiler brands or easy to implement. The thing had to be simply taken to the next level, but as it stands now, the behavior of aggregate initializers is IMO implementation defined.
On the other hand, I can never discriminate - what is underspecified and what is intently specified as undefined. The statements are not given any formal expression, so they can not be formally analyzed and formal inference is not applicable. You can never prove that some statement is specified or not, because only the direct applications have clear interpretation. Once you start picking on not-so-mainstream topics and you are in the dark.
To this day, I am still puzzled regarding pointer comparison issues and such. I don't want to delve further on this subject here. May be I'll create a thread with pointer questions again some day :)
(I am stubborn and persistent.)
I can not resist polluting this topic a bit though: when you interpret the standard (or drafts of it like me), do you ever rely on inferences of facts that were not obviously intent? Figuratively speaking - do you rely on stuff that comes from the side-pocket of some rule, or you look for clearly intent consequences only?
Thanks a bunch to everyone
EDIT:
The full expressions in an initializer-clause are evaluated in the order in which they appear. |
Yeah, I think I saw that myself, but it settles another question - the order in which side-effects from the expressions will be applied. (Not these side-effects we are discussing...) It may have been the intention to mean more then that, but IMO this exact wording does not carry the message that my code is portable.