You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code that uses switch on system constants needs to be updated to use if statements. That's unavoidable unfortunately. It's the one major breakage we needed to make in terms of compatibility. The tradeoff is explained in the APE blog post:
That one thing aside, if it's this easy, why has no one done this before? The best answer I can tell is it requires an minor ABI change, where C preprocessor macros relating to system interfaces need to be symbolic. This is barely an issue, except in cases like switch(errno){case EINVAL:...}. If we feel comfortable bending the rules, then the GNU Linker can easily be configured to generate at linktime all the PE/Darwin data structures we need, without any special toolchains. https://justine.lol/ape.html
When using a switch statement, constants that are part of
errno.h
(ENOENT
,EACCES
etc.) are not available as case labels at compile-time.Minimal example:
The following compilation error is raised when attempting to compile with cosmopolitan libc.
The text was updated successfully, but these errors were encountered: