threads / discuss / 2209

The MIT error

Subject: The MIT error

## tl;dr

One message between Oct 24, 2005 and Oct 24, 2005.

replies: 0people: 1as markdown or json

Morten Welinder· Oct 24, 2005, 18:57 UTC · lore

After the isspace/BSD conflict I looked into what reserved symbols are being used by git. Quite a few, it turns out.

--M.
The C standard says you should not use identifiers matching:
    (is|to)[a-z].*                         <-- such as isize
    E[0-9A-Z].*                         <-- such as EMIT
    str[a-z].*                              <-- such as strbuf
    (PRI|SCN)[a-zX].*
    LC_[A-Z].*
    (SIG|SIG_)[A-Z].*
    (uint|int).*_t
    (UINT|INT).*_(MIN|MAX|C)
    wcs[a-z].*

The three top ones are the easiest to violate. While fixing the existing violations is probably pointless, new code ought not make things worse.

Just as isspace is reserved by the C implementation...
       7.26.2  Character handling <ctype.h>
       [#1]  Function  names that begin with either is or to, and a
       lowercase letter (possibly followed by  any  combination  of
       digits,  letters,  and  underscore)  may  be  added  to  the
       declarations in the <ctype.h> header.

[so there goes any use of "isize"], so are macro names EMIT, ETHIS, and ETHAT, at least when <errno.h> is included.

      7.26.3  Errors <errno.h>
       [#1] Macros that begin with E  and  a  digit  or  E  and  an
       uppercase  letter  (possibly  followed by any combination of
       digits,  letters,  and  underscore)  may  be  added  to  the
       declarations in the <errno.h> header.

quote.c:#undef EMIT quote.c:#define EMIT(x) ( (++len < n) && (*bp++ = (x)) ) quote.c:#define EMITQ() EMIT('\\') server-info.c:#define EMITTED 04 tar-tree.c:#define EXT_HEADER_PATH 1 tar-tree.c:#define EXT_HEADER_LINKPATH 2 ls-files.c:#define EXC_CMDL 0 ls-files.c:#define EXC_DIRS 1 ls-files.c:#define EXC_FILE 2 epoch.h:#define EPOCH_H update-index.c:static inline void *ERR_PTR(long error)

        7.26.10  General utilities <stdlib.h>
       [#1] Function names that begin  with  str  and  a  lowercase
       letter  (possibly  followed  by  any  combination of digits,
       letters, and underscore) may be added to the declarations in
       the <stdlib.h> header.

← back to recent threads