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

"If EINVAL is not a compile-time constant, four of the initializations above are not valid"

Wait, why isn't EINVAL a compile-time constant, shouldn't it just be an enum?



It has a different constant value on different OS's (Linux, Mac, Windows, etc).

Therefore the resulting code, which must run on any OS, cannot treat it as a constant.


Thus proving that APEs are not viable, the end.

The assumption that constants are constants is a sound assumption, and I highly doubt many would be willing to rewrite the world to make some "clever hack" work.


> I highly doubt many would be willing to rewrite the world to make some "clever hack" work.

I specifically wanted to avoid rewriting the world in order to port established codebases like git/curl to Cosmopolitan Libc.

My goal with this gcc patch was to answer the question: "what is the minimum amount of source code I would have to manually change in order to port software to Cosmopolitan Libc?". As we find out, sometimes we don't have to change anything to compile code for an Actually Portable Executable -- just do the usual ./configure && make, and a small `objcopy` command at the end to create the APE.


Ah, right, so while you and I don't care what numerical value in the enum EINVAL has, if I take that numerical value and stuff the binary into another OS then it means something totally different.

Right, it's not that it *isn't* a constant, it's that its not the *same* constant everywhere?


Correct.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: