27-05-2010, 11:04 AM
Lundin Wrote:According to the rule "errno" shouldnt be used at all, because it -isn't- well defined. It is only relevant how it is defined in ISO C, not in some homemade C standard for this or that OS.
I agree. Linux is written using GCC which has it's own standard. It is not ISO -C more to the point there are no defined error numbers in ISO-C. Everything says there "may" be an error number. No specification to what the error number is. BTW I once, well over a decade ago, had an error routine that checked for any return >0. Trouble was one (and only one) funnction in the library used negative numbers for errors...
I have never found any consistancy between any compiler libraries on errno. The only consistancy is those compilers who share the same library. Whilst this will usually work for for commercial compilers wherey they tend to use the same library across all their compilers for GCC the inverse is true as there are very many different libraries available. So no two people using, for example, a GCC-ARM compiler may be using the same library. Thus the errno might/will be different or missing all together.