C++ Logo

std-discussion

Advanced search

A lifetime question about start_lifetime_as

From: Yongwei Wu <wuyongwei_at_[hidden]>
Date: Tue, 8 Jul 2025 21:57:15 +0800
Assume I am working on a little-endian machine only. Is the following
code undefined behaviour?

uint32_t data = 0x40400000;
auto f = *std::start_lifetime_as<float>(&data);

If it is not, is the data variable still accessible now?

Best regards,

Yongwei

-- 
Yongwei Wu
URL: http://wyw.dcweb.cn/

Received on 2025-07-08 13:57:33