POSIX 2008 C Extensions and restrict Keyword

Sebastian Huber sebastian.huber@embedded-brains.de
Wed Jul 10 08:40:00 GMT 2013


On 07/09/2013 05:59 PM, Craig Howland wrote:
>> (1) From the notes, the restrict keyword was added for alignment
>> with ISO/IEC 9899:1999 which is C99.  The current sys/cdefs.h
>> defines __restrict which is conditionalized based on the compiler
>> and language version. Would it be OK to start sweeping __restrict
>> in per POSIX/C99?
> I would think that we should want them in there.
>
> Assuming that it is done, however, we should use restrict, not __restrict.  The
> latter apparently dates from 2000 when the keyword was brand new.  Since it is
> now pushing 14 years, I suggest that updating sys/cdefs.h to get rid of the __
> is in order.  More than that, sys/cdefs.h is looking only at GCC versions.
> This really would be better as a configure check, as you'd think that any
> remotely recent compiler is pretty likely to accept restrict (whether it acts
> on it or not).

I updated the "newlib/libc/include/sys/cdefs.h" to match the current FreeBSD 
version:

http://www.cygwin.com/ml/newlib/2013/msg00242.html

This makes it easier to use code from FreeBSD (e.g. the network stack).  I 
would appreciate it if we can keep the compatibility with the FreeBSD version.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list