[En-Nut-Discussion] Nut/OS finally moving to C99 types

Thiago A. Corrêa thiago.correa at gmail.com
Thu Apr 17 21:47:39 CEST 2008


Actually, it's --std=c99' ish now *smile*

It makes a lot more sense when the return value is only for indicating
success or failure, or enable/disable, etc.... If only two values are
valid, there is no reason to use a broader type.

If the intent is to follow what standard libs use for return types is
one thing, but we should consider using bool's when they are
appropriate.
It provides the compiler with optimization opportunities, and I'm sure
the standards committee have seen other advantages other than just
syntax sugar, although that is reason enough in terms of readability.
States without any doubt that the variable can only assume 2 states,
no more, no less. No grep'ing for that variable to see the possible
states.

On Thu, Apr 17, 2008 at 6:34 AM, Harald Kipp <harald.kipp at egnite.de> wrote:
> Thiago A. Corrêa wrote:
>  >     IMHO, we should consider moving return types for many calls to
>  > bool (_Bool) instead. Makes the code the most readable.
>
>  IMHO, this is too C++-ish. There are several discussion about using bool
>  with C. My opinion is, that it is not needed. Most C standard routines
>  return 0 on success and -1 on errors.
>
>  Harald
>
>
> _______________________________________________
>  http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>



More information about the En-Nut-Discussion mailing list