2 ms·
C23 gets #embed https://thephd.dev/finally-embed-in-c23 https://thephd.dev/finally-embed-in-c23 and in practice later C++ compilers will presumably also just do
by tialaramex 3y ago
C23 gets #embed https://thephd.dev/finally-embed-in-c23 https://thephd.dev/finally-embed-in-c23 and in practice later C++ compilers will presumably also just do #embed rather than pretend they aren't the same code anyway.
However, even though there's a clear need, as that post explains, the compilers varied between "Bad at this" and "Completely awful at this" which is part of what was so frustrating for JeanHyde over years of getting this through committee.
In principle #embed is just shoving the bytes in as comma separated values, but in practice by the "as if" rule in C and C++ the compiler won't do that because it's stupid.
- est31 3y agoSince Rust 1.67.0, the compiler has a specific optimized code path for the (already older) include_bytes! macro: https://github.com/rust-lang/rust/pull/103812#issuecomment-1299087888 https://github.com/rust-lang/rust/pull/103812#issuecomment-1...
- tialaramex 3y agoHa, cute, I think I began examining details of include_bytes! only this year so it's possible I happened to first look at this soon after the big improvements landed in the release I was testing against.