Fixing C's Biggest Mistake
areYouSureAboutThat
areYouSureAboutThat at gmail.com
Wed Dec 28 02:22:18 UTC 2022
On Tuesday, 27 December 2022 at 22:54:59 UTC, Walter Bright wrote:
>
> ...
> D's positive initialization also ensures that instances will
> not be initialized with random garbage.
and it may not be 'random garage'. it could be your privateKey.
and you don't want to be sending your unintialised buffer over
the network with your privateKey still in it...
It is very difficult to argue against init-by-default, in any
language.
Thankfully D provides an opt-out -> '.. = void'; (except for
pointers in @safe mode).
But I would never support default-init for stack/heap allocations
in C. How would I then discover your privateKey!?!?
More information about the Digitalmars-d
mailing list