3 ms·
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] = { #
by eps 4y 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.
- tazjin 4y agoReproducible builds crowd wailing in agony
- huhtenberg 4y agoThe context is that of infinite files, not of the urandom specifically. Give the linked post a read for details.
- astrange 4y agoThey just need a reproducible urandom.
- kibwen 4y agoI 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.
- eps 4y agoA warning, not an error. Both under and over-population can be valid use cases.
- ealexhudson 4y agoThe 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.
- eps 4y agoThis 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.