Re: Fwd: Bug#1050663: dar option --on-fly-isolate creates catalogue with broken slice_layout
Rolf Gebhardt <[email protected]> Wed, 6 Sep 2023 18:29:00 +0200
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <[email protected]> |
Hi Denis,
I was somewhat confused about your finding concerning zero
initialization of objects.
> What does a default constructor in C++ seem to do, depend on the C++
> standard (pivot at C++11) but the object should be zero-initialized,
> that to say, the field slice_layout::older_sar_than_v8 should be set
> to false according to this reference (unless I misread it):
>
> https://en.cppreference.com/w/cpp/language/value_initialization
Since I started programming in C++ about 30 years ago, I was shure that
only static data gets zero-initialized. As far as I remember this is a
heritage of C wher this also was true.
It took some time till I realized that "value initialization" is not the
thing that happens if you declare an object without explicit
initialization like
MyTypeOrClass obj;
but seems to be the kind of initialization that is used if you declare
an object using an empty initializer e.g.
MyTypeOrClass obj {};
(Thanks for citing this article anyway. I dit not know that yet and It's
fine to learn something new even being old ;-) )
I think the relevant article is the one about "default initialization":
https://en.cppreference.com/w/cpp/language/default_initialization
where you find the note:
"Default-initialization of non-class variables with automatic and
dynamic storage duration produces objects with indeterminate values
(static and thread-local objects get zero initialized
<https://en.cppreference.com/w/cpp/language/zero_initialization>).
References and const scalar objects cannot be default-initialized."
Now my world is fine again :-)
> Cheers,
> Denis
>
A la tienne,
Rolf