Remix.run Logo
mgaunard 9 hours ago

surely the preprocessor method doesn't work in the general case, since the data can contain commas or parentheses.

Regardless all of the methods suggested are terrible. If you don't have access to #embed, just write a trivial python script.

david2ndaccount 8 hours ago | parent | next [-]

You can apply `#` to __VA_ARGS__, which won’t preserve the exact whitespace, but for many languages it’s good enough. biggest issue is you can’t have `#` in the text.

oguz-ismail2 8 hours ago | parent | prev [-]

How is `xxd -i' terrible?

mgaunard 8 hours ago | parent [-]

It's still lacking content that goes before/after the output.

Just write a Python script that does the whole thing.

oguz-ismail2 8 hours ago | parent [-]

Don't know what you mean, it works fine here. Python is too large and unreliable a dependency for something so trivial (which can be accomplished using standard POSIX utilities if need be).

astrobe_ 7 hours ago | parent | next [-]

Indeed, even writing this utility in C is trivial and has 0 extra dependency for a pure C/C++ project. Avoiding #embed also removes the dependency to a C++23 capable compiler, which might not be available in uncommon scenarios.

jcalvinowens 7 hours ago | parent | prev [-]

Python is pretty much mandatory for Linux systems nowadays, unless you're dealing with something really minimalist or trying to be very portable it's safe to rely on.

oguz-ismail2 7 hours ago | parent [-]

> it's safe to rely on

Is there any guarantee they won't break backwards compatibility again?

jcalvinowens 4 hours ago | parent [-]

I wrote this almost ten years ago and it still works fine: https://github.com/jcalvinowens/diveutils/blob/master/consta...

Arguably it could be a little C helper, but I wanted this particular piece of the project to be more accessible so I used a scripting language.