* The MIT error
@ 2005-10-24 18:57 Morten Welinder
2005-10-25 13:40 ` Horst von Brand
0 siblings, 1 reply; 4+ messages in thread
From: Morten Welinder @ 2005-10-24 18:57 UTC (permalink / raw)
To: GIT Mailing List
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.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: The MIT error
2005-10-24 18:57 The MIT error Morten Welinder
@ 2005-10-25 13:40 ` Horst von Brand
2005-10-25 13:52 ` Andreas Ericsson
0 siblings, 1 reply; 4+ messages in thread
From: Horst von Brand @ 2005-10-25 13:40 UTC (permalink / raw)
To: Morten Welinder; +Cc: GIT Mailing List
Morten Welinder <mwelinder@gmail.com> wrote:
> After the isspace/BSD conflict I looked into what reserved symbols are
> being used by git. Quite a few, it turns out.
[...]
> 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.
There go is_space(), etc as suggested by the relevant patches... in any
case, if you /don't/ #include <ctype.h>, you are safe (standardwise),
aren't you? [Yes, idiots who #include that in system headers are way
broken, but...]
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: The MIT error
2005-10-25 13:40 ` Horst von Brand
@ 2005-10-25 13:52 ` Andreas Ericsson
2005-10-25 16:50 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Ericsson @ 2005-10-25 13:52 UTC (permalink / raw)
To: GIT Mailing List
Horst von Brand wrote:
> Morten Welinder <mwelinder@gmail.com> wrote:
>
>>After the isspace/BSD conflict I looked into what reserved symbols are
>>being used by git. Quite a few, it turns out.
>
>
> [...]
>
>
>>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.
>
>
> There go is_space(), etc as suggested by the relevant patches...
No they don't. "begin with either is or to and a lowercase letter",
meaning (is|to)[a-z].*, just as Morten wrote. is_.* doesn't fall into
this category. The underscore exemption is so that users can write their
own is_file(), is_whatever() str_replace() and such. Some thought has
gone into the standard.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: The MIT error
2005-10-25 13:52 ` Andreas Ericsson
@ 2005-10-25 16:50 ` H. Peter Anvin
0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2005-10-25 16:50 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: GIT Mailing List
Andreas Ericsson wrote:
>
> No they don't. "begin with either is or to and a lowercase letter",
> meaning (is|to)[a-z].*, just as Morten wrote. is_.* doesn't fall into
> this category. The underscore exemption is so that users can write their
> own is_file(), is_whatever() str_replace() and such. Some thought has
> gone into the standard.
>
Also, note that we don't include <ctype.h>, and the reasons to stay out
of its namespace are:
a. potential for confusion (different semantics), and
b. broken system headers.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-25 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-24 18:57 The MIT error Morten Welinder
2005-10-25 13:40 ` Horst von Brand
2005-10-25 13:52 ` Andreas Ericsson
2005-10-25 16:50 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).