Changeset 84a1a54 in mainline for uspace/lib/c/include/stdlib.h


Ignore:
Timestamp:
2018-01-04T20:47:53Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
facacc71
Parents:
cde999a
Message:

Wrap returns of errno from main() with EXIT_RC().

Returns of error code from main() prevent type checking when errno_t
and int are considered incompatible. In order to avoid the philosophical
discussion of what should and shouldn't be returned for main(), we simply
wrap the error values and leave the answer to the question for future
generations to decide.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/stdlib.h

    rcde999a r84a1a54  
    5151extern void exit(int) __attribute__((noreturn));
    5252
     53#define EXIT_SUCCESS 0
     54#define EXIT_FAILURE -1
     55
     56#include <errno.h>
     57static inline int EXIT_RC(errno_t rc) {
     58        return (int) rc;
     59}
     60
    5361#endif
    5462
Note: See TracChangeset for help on using the changeset viewer.