C++ Logo

sg12

Advanced search

Re: [ub] Undefined behaviour from uninitialised variables

From: Christopher Jefferson <chris_at_[hidden]>
Date: Thu, 31 Oct 2013 17:34:47 +0000
On 31 October 2013 17:20, Nevin Liber <nevin_at_[hidden]> wrote:
> On 31 October 2013 04:16, Christopher Jefferson <chris_at_[hidden]>
> wrote:
>>
>>
>>
>> Her suggested fix is to introduce a new notation for constructors
>> which means "I am not initialising this member on purpose". This will
>> allow compilers to then add a warning at a high warning level that a
>> member is missed from a constructor.
>
>
> Had I a time machine, this would be my preference (not just missing members,
> but all uninitialized variables). But I agree with Ville that this would
> break backwards compatibility.
>
> On the other hand, maybe adding an attribute would help?

Sorry, I should have been more clear.

I was not suggesting that we remove the old notation, as you say that
is impossible. However, with an attribute to denote "I really meant to
leave this variable/member unitialised", compilers could more eagerly
warn about uninitialised variables or members.


Chris

Received on 2013-10-31 18:34:48