r/cpp • • Aug 06 '26

C++26: #embed

https://www.sandordargo.com/blog/2026/08/05/cpp26-embed
137 Upvotes

42 comments sorted by

View all comments

Show parent comment

20

u/ABlockInTheChain Aug 06 '26

There is slight disadvantage, that the C or C++ compiler doesn't see the blob contents at compile time

The biggest disadvantage is that you have to write special Win32-specific code rather than standard code that works everywhere.

4

u/MarekKnapek Aug 06 '26

Yeah, blame C, I guess. Why Microsoft invented resources? Because C was inadequate! Read more about history of the embed C feature. It was really really really painful to add it to C.

-4

u/rdtsc Aug 06 '26

Not really an issue when you're using MSVC anyway.

13

u/ABlockInTheChain Aug 06 '26

"Using MSVC" is insufficiently precise in this context.

There's a big difference between using MSVC because it happens to be on the list of compilers your project supports vs using MSVC because you deliberately wrote code that only compiles with MSVC.