C++ Logo


Advanced search

Re: Poisoned initializers

From: Antoine Viallon <antoine_at_[hidden]>
Date: Sat, 12 Jun 2021 22:36:50 +0000
-------- Message transféré ------- De: "Antoine Viallon" <antoine_at_[hidden] (mailto:antoine_at_[hidden]?to=%22Antoine%20Viallon%22%20<antoine_at_[hidden]>)> À: "Edward Catmur" <ecatmur_at_[hidden] (mailto:ecatmur_at_[hidden]?to=%22Edward%20Catmur%22%20<ecatmur_at_[hidden]>)> Envoyé: 13 juin 2021 00:35 Objet: Re: [std-proposals] Poisoned initializers What does it mean to prove that an uninitialized value is used? In some cases, the compiler might be unable to know if a value is undefined or not at compile time (for instance, if it is the return value of a function). Actually, we want runtime effects; at least 3 distinct effects.Runtime effects might be undesirable in C++, which has traditionally be very conservative in that regard. In secure mode, we want a specific value to be loaded in place of the uninitialized value; While it may be desirable, it may not always be possible. What value should a free'd pointer have? What value should an undefined variable of a user-provided type have? In my opinion, this keyword should have the same kind of effect the [[deprecated]] attribute has: to fire compiler warnings or errors if the function of variable is used. The main difference with [[deprecated]] would be that theses warnings/errors depend on the value of the variable, and not on the variable itself. Just my two cents, Antoine Viallon

Received on 2021-06-12 17:36:56