tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strerror(0) POSIX compliance



gdt%ir.bbn.com@localhost (Greg Troxel) writes:

>Why do you find it questionable?  If POSIX says the string must be empty
>or indicate there is no error, what's wrong with following POSIX?

>(I agree that calling strerror(0) is odd and a likely sign of a bug, but
>that's separate from complying with standards when compliance isn't
>harmful.)

Well, if calling strerror(0) is a bug, then usually because it's called
after an error condition that didn't set errno.

Then returning "Success" or even an empty string is misleading or as
Joerg put it: questionable. It should return a phrase that is easily
identified as the errno==0 value.


-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index