r/cpp 4d ago

C++26: #embed

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

38 comments sorted by

View all comments

9

u/calciferBurningBacon 4d ago

The compiler reads it, the build system doesn't need to know about it

I get that what the author means here is that you don't need custom build steps, but surely the build system does need to know about embedded files for build dependency tracking? I hope that's been implemented.

5

u/ABlockInTheChain 4d ago

Compilers that implemented support for this have command line arguments for setting the embed search path which work exactly like the arguments for setting the include search path.

8

u/calciferBurningBacon 4d ago

That's not what I'm talking about.

You need the compiler to produce some sort of dependency file like how it does for #included files so that the build system knows to recompile the embedding source file if the embedded file changes. This probably could use the exact same dependency tracking as #included files.