Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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". ;)


Well, just don’t do networking in the VM your builds run in and you’re good, maybe.


Remove /dev/urandom and replace it with /dev/zero in your sandbox ;)


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: