Discussion:
[decl.init]p10
(too old to reply)
m***@gmail.com
2018-10-10 15:23:18 UTC
Permalink
Hello,

In [decl.init]p10 (http://eel.is/c++draft/dcl.init#10), we can read
Every object of static storage duration is zero-initialized at program
startup before any other initialization takes place. In some cases,
additional initialization is done later.

As far as I understand basic.start.static, this is not correct. Let's
consider:

```
constexpr auto foo{ 42 };
int main()
{
return foo;
}
```

According to [basic.start.static]p2 (
Constant initialization is performed if a variable or temporary object
with static or thread storage duration is initialized by a constant
initializer for the entity. If constant initialization is not performed, a
variable with static storage duration ([basic.stc.static]) or thread
storage duration ([basic.stc.thread]) is zero-initialized ([dcl.init]).

`foo` is constant initialized. No zero initialization is performed.
Every object of static storage duration is static-initialized
([basic.start.static]) at program startup before any other initialization
takes place. In some cases, additional initialization is done later.

Do you recall such issue report or should I report it?
Of course if I'm right. If I've messed up something, please point it out.

(Unfortunately I don't have my personal C++17 standard copy. I'm basing at
'final working draft' from https://en.cppreference.com/w/cpp/links and
latest draft from http://eel.is/c++draft/)

Best,
Mateusz
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Edward Catmur
2018-10-11 11:16:12 UTC
Permalink
Post by m***@gmail.com
Hello,
In [decl.init]p10 (http://eel.is/c++draft/dcl.init#10), we can read
Every object of static storage duration is zero-initialized at program
startup before any other initialization takes place. In some cases,
additional initialization is done later.
That's a (non-normative) note, which is possibly why it was missed from the
resolution of http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#2026

I agree with your proposed resolution (replacing "zero-initialized" with
"static-initialized ([basic.start.static])"). I think this can probably be
classed as an editorial issue, since it is an obvious omission from the
resolution of CWG2026 and your resolution ensures the note conforms to the
normative portions of the Standard. Please
read https://github.com/cplusplus/draft/wiki/How-to-submit-an-editorial-issue
and submit your proposed resolution via GitHub.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
m***@gmail.com
2018-10-11 11:38:28 UTC
Permalink
Thank you. I'll submit it later today.

W dniu czwartek, 11 października 2018 13:16:12 UTC+2 uŌytkownik Edward
Post by Edward Catmur
Post by m***@gmail.com
Hello,
In [decl.init]p10 (http://eel.is/c++draft/dcl.init#10), we can read
Every object of static storage duration is zero-initialized at program
startup before any other initialization takes place. In some cases,
additional initialization is done later.
That's a (non-normative) note, which is possibly why it was missed from
the resolution of
http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#2026
I agree with your proposed resolution (replacing "zero-initialized" with
"static-initialized ([basic.start.static])"). I think this can probably be
classed as an editorial issue, since it is an obvious omission from the
resolution of CWG2026 and your resolution ensures the note conforms to the
normative portions of the Standard. Please read
https://github.com/cplusplus/draft/wiki/How-to-submit-an-editorial-issue
and submit your proposed resolution via GitHub.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Loading...