This is the mail archive of the
mailing list for the newlib project.
Re: Patch: Add __restrict to string.h
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Craig Howland <howland at LGSInnovations dot com>
- Cc: <newlib at sourceware dot org>
- Date: Mon, 22 Jul 2013 16:30:23 +0000
- Subject: Re: Patch: Add __restrict to string.h
- References: <6n1db1hws1heh5xc9vllbm19 dot 1374187318673 at email dot android dot com> <20130719095503 dot GA20871 at calimero dot vinschen dot de> <51ED4DC1 dot 8090206 at LGSInnovations dot com>
On Mon, 22 Jul 2013, Craig Howland wrote:
> We should be using "restrict" everywhere, not only in the docs. The C
> standard defines restrict as a keyword, just as it does const, volatile, etc.
> And it has been standard for more than 13 years. We do not use __const in
> headers, even though before C89 it was not standard but available as a GCC
> extension. So while 15 years ago using __restrict would have made sense, it
> is not appropriate now.
You do realise that GCC does not enable the C99 "restrict" keyword by
default, only in C99 mode (-std=c99/-std-gnu99/-std=c11/-std=gnu11), to
avoid breaking C90 programs that use it as an identifier? Using plain
"restrict" in headers would prevent using those headers in GCC's default
mode; even if defined to __restrict, it would prevent implementing a
proper C90 mode in the headers.
Joseph S. Myers