New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[basic.life]/8 Add a note about pointer to uninitialized memory #5782
Comments
What is
|
"uninitialized memory" refers to memory that never has any objects on it. |
I think we do not have such things because we implicitly create objects. Also, my question was about pointer, not about memory. |
@blackteahamburger , please give a code example. |
Just call a function that doesn't do IOC:
|
@blackteahamburger , this is not a conforming C++ program; its behavior is not specified by the standard. Do you have an example of a conforming program? |
IOC functions are not limited to those specified in the standard. Well, ofc, an implementation should define them as IOC, but implementations often ignore the requirement to specify implementation-defined things. I'd say you can treat |
I forgot that IOC do not start the lifetimes of subobjects of such objects that are not themselves of implicit-lifetime types... Just use
|
@blackteahamburger your concern is [basic.life]/8's
condition, and that the lifetime of the first element of the implicitly-created |
@languagelawyer But I think they are related. |
I think the
condition is slightly misspelled. It does not mean that there necessarily shall be lifetime end, but that if there is lifetime end, it shall be properly synchronized (new object creation shall happen-after the lifetime end). |
I'm not sure if there's an editorial issue here. Please reopen if you have a clear improvement in mind. |
Transparently replaceable only applies to objects, so creating an object on uninitialized memory does not automatically make a pointer to the original uninitialized memory point to the newly created object.
Nothing in the standard mentions the above fact. It is recommended to add a note to provide clarity.
The text was updated successfully, but these errors were encountered: