[haiku-development] Re: replacing runtime_loader

  • From: Tim Kelly <gtkelly@xxxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 16 Mar 2016 20:38:13 -0400

François Revol wrote:

That's because historically BeOS error codes are negative (which makes
much more sense than using "return -EINVAL" (which is both errorprone et
ugly) (but POSIX or ISO C doesn't care about making sense).

But some software are so badly written and full of those -EFOO that we
have to resort to this madness to redefine errors as positive integers
to abide by ISO C and POSIX (although POSIX did change its mind at one
point from "non 0" to "positive"), and link to a posix_error_mapper
static library.

Ah - thank you.

So, no, I didn't realize I was seeing the actual return value. It took a
while.  :-)

There's an "error" command in the shell for that :)

Oh - indeed, this could be handy:

~> error
usage: error <error number>
Prints clear text error messages for given error numbers.

Would the reverse be useful? - enter a string and get the error code value: error [-n] 0x80000005 --> Invalid Argument; error -s 'Invalid Argument' --> 0x8000005 or B_BAD_VALUE or some decomposition as appropriate, and maybe any complimentary values

   case B_NO_MEMORY:
   case B_POSIX_ENOMEM:
       // ENOMEM
        return "Out of memory";

Just a thought.

tim

--
A leopard can't change its spots.

        --  Society

Other related posts: