Re: Fwd: Bug#1050663: dar option --on-fly-isolate creates catalogue with broken slice_layout

Denis Corbin <[email protected]> Sun, 10 Sep 2023 16:14:23 +0200
Newsgroups gmane.comp.sysutils.backup.dar.support
Message-ID <[email protected]>
On 06/09/2023 18:29, Rolf Gebhardt wrote:
> Hi Denis,

Hi Rolf,


[...]

> 
> 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 ;-) )

And so do I...

> 
> I think the relevant article is the one about "default initialization":
> 
> https://en.cppreference.com/w/cpp/language/default_initialization

thank you for this reference, I agree this is not "value initialization" 
that is pertinent here but "default initialization".

and the scenario described in the Notes matches what succeeded in libdar:

https://en.cppreference.com/w/cpp/language/default_initialization#Notes

just replacing:
- T2 by slice_layout and
- T2::mem by slice_layout::older_sar_than_v8

you get:

"t2.mem is default-initialized (to indeterminate value)" (!)

... I would not have called that "initialization"... but... anyway :)

Also, what I mentioned previously is inaccurate:
"By the way for the fun, the slice_layout class is used at two places:
- sar header...
- header_version (where this field has no importance! It must just have
   a valid value written in the archive)"

This is only true when the archive of reference has no slicing.
When slicing is used, all fields of the slice_layout stored in the 
header_version are properly set (including older_sar_than_v8) and are 
important.

> 
> 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,

Prost,
:)

> 
> Rolf
> 
> 

Denis
OpenPGP_signature (application/pgp-signature, 840 B) - not displayed