Definition of _NERROR in errno.h - Minix

This is a discussion on Definition of _NERROR in errno.h - Minix ; Hi all, anybody knows, why "#define _NERROR 70" is not defined to the maximum error number plus one? By the way i doubt the importance of this define statements existence, since AFAIK it is reference in one file (commands/syslogd/syslogd.c) only. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Definition of _NERROR in errno.h

  1. Definition of _NERROR in errno.h

    Hi all,

    anybody knows, why "#define _NERROR 70" is not defined to the maximum
    error number plus one?

    By the way i doubt the importance of this define statements existence,
    since AFAIK it is reference in one file (commands/syslogd/syslogd.c)
    only.

    As I'm currently about to port Minix to a research processor platform,
    some more questions like this may arise in future...

    Best regards

    Alex

  2. Re: Definition of _NERROR in errno.h

    On 07/24/08 13:24, A. Schabel wrote:

    > anybody knows, why "#define _NERROR 70" is not defined to the
    > maximum error number plus one?


    Because it should be expanded to the maximum number allowed as errno.
    It was originally used in the declaration of the array of strings used
    in the library function strerror() to avoid accesses out of the array
    limits.

    In Minix 3.1.2 it is of no use since the library function uses
    variable _sys_nerr which is automatically defined as the size of the
    array (see the file errlist.c).

    > By the way i doubt the importance of this define statements
    > existence, since AFAIK it is reference in one file
    > (commands/syslogd/syslogd.c) only.


    Because it was initially ported to a older version of Minix and
    _NERROR was used to make the checks that now are already implemented
    in strerror().

    > As I'm currently about to port Minix to a research processor
    > platform, some more questions like this may arise in future...


    Ciao
    Giovanni
    --
    A computer is like an air conditioner,
    it stops working when you open Windows.
    Registered Linux user #337974 < http://giovanni.homelinux.net/ >

+ Reply to Thread