Date: Tue, 25 Feb 2025 19:45:46 +0800
According to the current standard draft, is the [[indeterminate]]
attribute not applicable to data members? [dcl.attr.indet] seems to
imply so currently.
Suppose the following class:
class Obj {
public:
Obj() = default;
int calculate(int param)
{
// Some calculation that utilizes the scratch buffer
}
private:
int x{};
int y{};
std::byte scratch_buffer[2048]; // [[indeterminate]] intended
};
Currently, Obj::scratch_buffer will contain indeterminate values. In
C++26, will there be a way for it to opt out of the erroneous value
initialization, sans requiring the user to change the client-side
code?
Or do I miss something?
attribute not applicable to data members? [dcl.attr.indet] seems to
imply so currently.
Suppose the following class:
class Obj {
public:
Obj() = default;
int calculate(int param)
{
// Some calculation that utilizes the scratch buffer
}
private:
int x{};
int y{};
std::byte scratch_buffer[2048]; // [[indeterminate]] intended
};
Currently, Obj::scratch_buffer will contain indeterminate values. In
C++26, will there be a way for it to opt out of the erroneous value
initialization, sans requiring the user to change the client-side
code?
Or do I miss something?
-- Yongwei Wu URL: http://wyw.dcweb.cn/
Received on 2025-02-25 11:46:00