Date: Mon, 24 Apr 2000 08:44:59 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Martin Str|mberg cc: DJGPP-WORKERS Subject: Re: restrict In-Reply-To: <200004232143.XAA24489@father.ludd.luth.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 23 Apr 2000, Martin Str|mberg wrote: > According the the gcc manual restrict is only available if > "-flang-isoc9x" option is given to gcc. And that seems to be a > documentation bug, you need to use "-std=iso9899:199x according to > . Yes, this is a known bug. > So I sueggest we use __restrict__ instead of restrict which seems to > be recognised always (I guess, from the documentation). What docs says __restrict__ is always recognised? And what does ``always'' mean here? > So how far back was __restrict__ supported? The following example (from the C99 standard) doesn't compile with GCC 2.7.2.1: void foo (int n, int * __restrict__ p, int * __restrict__ q) { while (n-- > 0) *p++ = *q++; } The #ifdef magic below (lifted from the GCC bug-reporting list) seems to imply that __restrict__ is only supported in GCC 2.91 and later. > Or can we demand that users of DJGPP v. 2.04 use gcc 2.95.2? I would like to avoid requiring specific versions of GCC, unless we absolutely must. > Or do you know/suggest a different approach (some magic #define > somewhere, perhaps)? I suggest the following: #if __STDC_VERSION__ >= 199901 #elif __GNUC__ >= 2 && __GNUC_MINOR__ >= 91 #define restrict __restrict__ #else #define restrict #endif In a recent discussion, this seems to have got a semi-formal blessing of at least one GCC maintainer.