220 14874 <4720a9a6-24d5-4488-a229-2bdf2433fa03@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: =?UTF-8?Q?Germ=C3=A1n_Diago?= <germandiago@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Safer C++: never allow implicitly uninitialized variables?
Date: Fri, 5 Dec 2014 22:10:24 -0800 (PST)
Lines: 89
Approved: news@gmane.org
Message-ID: <4720a9a6-24d5-4488-a229-2bdf2433fa03@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1799_1323316710.1417846224433"
X-Trace: ger.gmane.org 1417846237 1124 80.91.229.3 (6 Dec 2014 06:10:37 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 6 Dec 2014 06:10:37 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDC2VXM4YYDRBUV3RKSAKGQEBHRU66Q@isocpp.org Sat Dec 06 07:10:31 2014
Return-path: <std-proposals+bncBDC2VXM4YYDRBUV3RKSAKGQEBHRU66Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f198.google.com ([209.85.214.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDC2VXM4YYDRBUV3RKSAKGQEBHRU66Q@isocpp.org>)
	id 1Xx8ZY-0007C8-Cc
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Dec 2014 07:10:28 +0100
Original-Received: by mail-ob0-f198.google.com with SMTP id vb8sf10439778obc.1
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Dec 2014 22:10:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:subject:mime-version:content-type
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=9x1FkPzd8L7KKUSvhwV1HQvT7GHhwSnYhZg+icX0Y3w=;
        b=bR+tKja9Qayzx8tgyJD2epxPfJGK555RzNlJko+tWKelBuPazced7xuPSBRkU9OYde
         tjPWQcYDxgSuyeneXQCMIqmRrLRMMg4DT0OMZ6lvtUHAAX2Spy8M93S7X4h5zf6WCxX2
         1MzWpDN4C71pfdGoHiTgeKJL9quoFncSIFFsM+K97rz1a3cRY2qcCjFJfky+dO4JeSMh
         Lh6g4aT+gjUHpZMdO1KXMcibBtO2OLr+2A78Bd0QJh8ARUe+ewQ0ZATMK5S+PxuYyQCE
         StXY/vW/KutXg+SW8XqjVACANr1tBGfOiX1f7f4r2+sRSPl91zrgOs6JTauSdrxA8+H2
         10bg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=9x1FkPzd8L7KKUSvhwV1HQvT7GHhwSnYhZg+icX0Y3w=;
        b=cuzjz58r+4jMDG7AY1IjDcIvMEO5HCAvGVImts6YWJ3dzlYg6DXO7FYAQZiMBPcDTG
         gzgXnO7kc6qLEGCAI5lyAuoVNnM7LGSuEKKep1id+rW9Hq6nUL+fnsZpz5mJ4ePrqNNT
         /tpiAQbMwHgiMJ6kXJqlZrpyJ6xGC96dVAI7orVqZrZLzZCe6uPy9YIzhA195zCKrZpl
         80nq93FPgvS2A71Zb3fdBy02syTkLo/cRwTVF6DEd+zHmkVXRcLH/5amqD33AC4zowO1
         PbbvNQmbeJyO3LJ9oRqm2K45uW4pVPzfIFKov/u42QnyBjWrT47PNsF2W5dkBG8G4Ug7
         xclg==
X-Gm-Message-State: ALoCoQmH/Y7eqXdYC5FqH3OWsP8JB1ovTUdUnfC54yriwUlpnmT3mh0is7bzg37leZN1omMmRnM9
X-Received: by 10.50.88.10 with SMTP id bc10mr6261056igb.5.1417846227271;
        Fri, 05 Dec 2014 22:10:27 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.11.42 with SMTP id v42ls1530991ioi.108.gmail; Fri, 05 Dec
 2014 22:10:25 -0800 (PST)
X-Received: by 10.50.110.42 with SMTP id hx10mr106369igb.16.1417846225938;
        Fri, 05 Dec 2014 22:10:25 -0800 (PST)
X-Original-Sender: germandiago@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:14874
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/14874>

------=_Part_1799_1323316710.1417846224433
Content-Type: multipart/alternative; 
	boundary="----=_Part_1800_1643296638.1417846224433"

------=_Part_1800_1643296638.1417846224433
Content-Type: text/plain; charset=UTF-8

Hello everyone,

I wonder if it would make sense to make variables in C++ automatically 
value-initialized or there would be problems.

Since we are making c++ safer and safer, would it make sense to do the 
following?


int a; //value-initialized to 0

Later, some syntax like in D language could be provided:

int a = void;


The rationale behind this change would be:

- an uninitialized variable that is replaced by these new semantics does 
not produce incorrect behaviour.
- makes the language safer to use.

In the case where performance must be preserved, a compiler option with the 
old semantics would be enough.

Would this make any sense or I am missing manu points? It looks to me that 
this could be backwards-compatible
and the noly thing that could happen is a performance bug, which can be 
solved replacing iniitialization or by a
compiler switch for large codebases.



-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1800_1643296638.1417846224433
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello everyone,<div><br></div><div>I wonder if it would ma=
ke sense to make variables in C++ automatically value-initialized or there =
would be problems.</div><div><br></div><div>Since we are making c++ safer a=
nd safer, would it make sense to do the following?</div><div><br></div><div=
><br></div><div>int a; //value-initialized to 0</div><div><br></div><div>La=
ter, some syntax like in D language could be provided:</div><div><br></div>=
<div>int a =3D void;</div><div><br></div><div><br></div><div>The rationale =
behind this change would be:</div><div><br></div><div>- an uninitialized va=
riable that is replaced by these new semantics does not produce incorrect b=
ehaviour.</div><div>- makes the language safer to use.</div><div><br></div>=
<div>In the case where performance must be preserved, a compiler option wit=
h the old semantics would be enough.</div><div><br></div><div>Would this ma=
ke any sense or I am missing manu points? It looks to me that this could be=
 backwards-compatible</div><div>and the noly thing that could happen is a p=
erformance bug, which can be solved replacing iniitialization or by a</div>=
<div>compiler switch for large codebases.</div><div><br></div><div><br></di=
v><div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1800_1643296638.1417846224433--
------=_Part_1799_1323316710.1417846224433--

.
