Comment by eps
3 years ago
Re: #embed </dev/urandom>
Just a random thought, but I'd expect a compiler to do exactly what's described if I tell it:
static char foo[123] = {
#embed </dev/urandom>
};
This would address the most common case with infinity files, and then just let the compiler error out if the array size is not specified.
I would expect that to produce an error, though. If I had a regular file that was not infinite in size, and I specified the wrong length for the array, I would find it more useful to have the compiler inform me as to the discrepancy rather than truncate my file.
A warning, not an error. Both under and over-population can be valid use cases.
Reproducible builds crowd wailing in agony
The context is that of infinite files, not of the urandom specifically. Give the linked post a read for details.
They just need a reproducible urandom.
Looks like you forgot to add your sponsor disclaimer "message sponsored by NSA". ;)
2 replies →
The preprocessor needs to run before the compiler, though, and isn't complex enough to understand the context of the code that it's in. That would be a substantially complex thing to implement.
This will indeed require delaying population of the array to the compilation stage. However it's worth the convenience and the succinctness of the syntax, and it's not that substantially complex to implement.