Topic: Explicitly uninitialized variables with = void, with


Author: Matthew Fioravante <fmatthew5876@gmail.com>
Date: Sat, 18 Mar 2017 13:20:36 -0700 (PDT)
Raw View
------=_Part_3606_1118199940.1489868436941
Content-Type: multipart/alternative;
 boundary="----=_Part_3607_244345541.1489868436942"

------=_Part_3607_244345541.1489868436942
Content-Type: text/plain; charset=UTF-8

In C++, we inherited this rule from C where primitive types like ints and
pointers are uninitialized by default.

Before getting into it, essentially what I'm suggesting is first we add a
syntax for explicitly leaving a variable uninitialized

int x = void; //I'm telling you x really is intended to start its life
uninitialized
std::cout << x << std::endl; //undefined behavior

Next, we can suggest compilers warn if you don't provide an initializer for
types that would otherwise default to be uninitialized.

int x; //warning no initializer! Use = void to create unintialized.
void* p; //warning no initializer! Use = void to create uninitialized.
Suggest = nullptr for pointers.
vector<int> y; //Ok
int* z = nullptr; //Ok
int w = void; //Ok
char buf[4096] = void; //Ok
struct P { int x = 0; int y = void; int z = void; }; //Ok
P p = void; //Ok??
std::vector<int> v = void; //Error, cannot use = void for non-trivial types.

Note that for class types with constructors like vector, you can still go
on with no initializer. The warning scheme is what maintains backwards
compatibility. Migrating an old codebase to be warning free by just
replacing all violations with = void is trivial via tooling nowadays.

There are some real benefits to uninitialized variables and some made up
ones. But the bottom line is default uninitialized makes it very easy to
write bugs, especially for beginners.

What are the supposed benefits of uninitialized variables?

1. Error detection.

Uninitialized memory access provides louder errors. A UMA can cause a crash
with a core dump for ready debugging. They can easily be detected by modern
tools like valgrind and address sanitizer. UMA's can also result in
non-sense values that are outside of the range of whats expected, more
easily corrupting the result of the entire application and making the
problem easier to be noticed by an operator.

The last point is also dangerous. Imagine a trading system where an
uninitialized memory read causes you to to buy several billion dollars in
shares vs an incorrectly initialized variable at 0 simply causes you do not
do anything.

2. Optimization opportunities.

This code does 2 copies.

char buf[4096] = {} //initialize to all zeroes
memcpy(buf, otherbuf, sizeof(buf));

If one removes the `= {}` bit, we don't initialize anything until memcpy is
called. Saving useless work.

Some of these are suspicious at best, as modern compiles should be able to
detect these scenarios and optimize out the redundant writes. Compilers
have been eliminating dead stores for years. Still, we don't always have
the best compilers especially in the embedded word. This kind of thing can
be checked in the assembly.

In general, being able to take advantage of undefined behavior for error
checking and optimization is a good thing. However I don't think its good
how easily C++ lets you slide into UB land in subtle and non-obvious ways.
Its important to have all of the levers available, they just need to be
organized properly so the easy ones are easy and the hard ones are hard.

Another thing really bad about unitialized by default is that it creates an
annoying and confusing rule about when you need to initialize variables.

When I write a class with members, like a trained monkey I always remember
to explicitly initialize the primitives. Its annoying for me to do this,
and more novice programmers often forget to do it.

struct Container {
int x = 0; //I have to remember to do this
Foo* p = nullptr; //Null pointer is almost always better than unitialized,
as it ready produces a segfault and easy debugging.
std::unique_ptr<Foo> p2; //Almost the same as p, but default initialized to
null.
std::vector<int> v;
std::array<int, 10> a = {{}}; //Yes you really need 2 braces on each
side... Why does this have to be so different than std::vector?
};

We can't ever touch the backwards compatible rules about uninitialized
variables. What we can do is add warnings and promote a safer more correct
style for modern C++. Its still confusing that int x; and vector<int> x;
are so different, but at least compilers can protect us from screwing this
up until we're expert enough to understand when = void makes sense.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1c1bbb0a-89cb-4c90-8384-94e92b61f649%40isocpp.org.

------=_Part_3607_244345541.1489868436942
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">In C++, we inherited this rule from C where primitive type=
s like ints and pointers are uninitialized by default.<br><br>Before gettin=
g into it, essentially what I&#39;m suggesting is first we add a syntax for=
 explicitly leaving a variable uninitialized<br><br><div style=3D"backgroun=
d-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style=
: solid; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprin=
t"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> x </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">void</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//I&#39;m=
 telling you x really is intended to start its life uninitialized</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">cout </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> x </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">endl</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//undefi=
ned behavior</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span></div></code></div><br>Next, we can suggest compilers warn if =
you don&#39;t provide an initializer for types that would otherwise default=
 to be uninitialized.<br><br><div style=3D"background-color: rgb(250, 250, =
250); border-color: rgb(187, 187, 187); border-style: solid; border-width: =
1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D=
"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> x</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #800;" class=3D"styled-by-prettify">//warning no=
 initializer! Use =3D void to create unintialized.</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">void</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> p</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//warni=
ng no initializer! Use =3D void to create uninitialized. Suggest =3D nullpt=
r for pointers.</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>vector</span><span style=3D"color: #080;" class=3D"styled-by-prett=
ify">&lt;int&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> y</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">//Ok</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> z </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">nullptr</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">//Ok</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> w </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">void</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//Ok</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">char</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> buf</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color: #=
066;" class=3D"styled-by-prettify">4096</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">]</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">void<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//Ok</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> P </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
x </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> y </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> z </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">void</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">//Ok</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>P p </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">void</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">//Ok??</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">vector</=
span><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;int&gt;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//Error, cannot use =3D void for non-trivial types.</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div>=
</code></div><br>Note that for class types with constructors like vector, y=
ou can still go on with no initializer. The warning scheme is what maintain=
s backwards compatibility. Migrating an old codebase to be warning free by =
just replacing all violations with =3D void is trivial via tooling nowadays=
..<br><br>There are some real benefits to uninitialized variables and some m=
ade up ones. But the bottom line is default uninitialized makes it very eas=
y to write bugs, especially for beginners.<br><br>What are the supposed ben=
efits of uninitialized variables?<br><br>1. Error detection.<br><br>Uniniti=
alized memory access provides louder errors. A UMA can cause a crash with a=
 core dump for ready debugging. They can easily be detected by modern tools=
 like valgrind and address sanitizer. UMA&#39;s can also result in non-sens=
e values that are outside of the range of whats expected, more easily corru=
pting the result of the entire application and making the problem easier to=
 be noticed by an operator.<br><br>The last point is also dangerous. Imagin=
e a trading system where an uninitialized memory read causes you to to buy =
several billion dollars in shares vs an incorrectly initialized variable at=
 0 simply causes you do not do anything.<br><br>2. Optimization opportuniti=
es.<br><br>This code does 2 copies.<br><br><div style=3D"background-color: =
rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; =
border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code =
class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #=
008;" class=3D"styled-by-prettify">char</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> buf</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">[</span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">4096</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">]</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">{}</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">//initialize to all zeroes</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>memcpy</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">buf</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> otherbuf</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">sizeof</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">buf</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">));</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></co=
de></div><br>If one removes the `=3D {}` bit, we don&#39;t initialize anyth=
ing until memcpy is called. Saving useless work.<br><br>Some of these are s=
uspicious at best, as modern compiles should be able to detect these scenar=
ios and optimize out the redundant writes. Compilers have been eliminating =
dead stores for years. Still, we don&#39;t always have the best compilers e=
specially in the embedded word. This kind of thing can be checked in the as=
sembly.<br><br>In general, being able to take advantage of undefined behavi=
or for error checking and optimization is a good thing. However I don&#39;t=
 think its good how easily C++ lets you slide into UB land in subtle and no=
n-obvious ways. Its important to have all of the levers available, they jus=
t need to be organized properly so the easy ones are easy and the hard ones=
 are hard.<br><br>Another thing really bad about unitialized by default is =
that it creates an annoying and confusing rule about when you need to initi=
alize variables.<br><br>When I write a class with members, like a trained m=
onkey I always remember to explicitly initialize the primitives. Its annoyi=
ng for me to do this, and more novice programmers often forget to do it.<br=
><br><div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: brea=
k-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">Container</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> x </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pretti=
fy">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">//I have to remember to=
 do this</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #606;" class=3D"styled-by-prettify">Foo</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> p </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">nullptr</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pre=
ttify">//Null pointer is almost always better than unitialized, as it ready=
 produces a segfault and easy debugging.</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">unique_ptr</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-=
by-prettify">Foo</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 p2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">//Almost the same as p, b=
ut default initialized to null.</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">vector</span><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">&lt;int&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> v</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">array</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"st=
yled-by-prettify">10</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> a </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">{{}};</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #800;" class=3D"styled-by-prettify">//Yes you really need 2 braces on=
 each side... Why does this have to be so different than std::vector?</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v><br>We can&#39;t ever touch the backwards compatible rules about uninitia=
lized variables. What we can do is add warnings and promote a safer more co=
rrect style for modern C++. Its still confusing that int x; and vector&lt;i=
nt&gt; x; are so different, but at least compilers can protect us from scre=
wing this up until we&#39;re expert enough to understand when =3D void make=
s sense.<br><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/1c1bbb0a-89cb-4c90-8384-94e92b61f649%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1c1bbb0a-89cb-4c90-8384-94e92b61f649=
%40isocpp.org</a>.<br />

------=_Part_3607_244345541.1489868436942--

------=_Part_3606_1118199940.1489868436941--

.