I'm writing a library in C. I have no idea where and how it's going to be used, so it should be generic.
Anyways, when an error occurs, I'm planning on changing errno and returning an integer indication an error.
My first question: is this legal? It's probably going to work on most - if not all - implementations, but I'd like to know if it's actually valid C. And I don't have the C standard anywhere.
Also, is there a portable way to add more exceptions? Is there an error code that is defined not to be used by libc?
Thanks in advance