Patch: Add __restrict to string.h

Joseph S. Myers
Mon Jul 22 16:31:00 GMT 2013

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

More information about the Newlib mailing list