[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: restrict

From: Ben Pfaff
Subject: Re: restrict
Date: Sun, 04 Feb 2007 11:45:25 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Jason Stover <address@hidden> writes:

> The latest checkout of gnulib puts a a couple of restricted
> qualifiers in declarations in string.h. This breaks the OBSD
> build with gcc 3.3.5.
> restrict is part of c99, right?
> So gcc 3.3.5 is breaking because it doesn't know about
> restrict?
> Shouldn't a portability library not bother with what seems like a kind
> of optimization that restrict is for? I mean, isn't that a decision
> best left to the compiler?

The configure script is supposed to detect whether the compiler
supports the "restrict" keyword.  If it doesn't, it should add
the line
        #define restrict
to config.h, so that any use of restrict is dropped by the

Can you check whether your config.h defines restrict this way?
If it doesn't, then we should figure out why.  If it does, then
the most likely problem is that the source file or files that
trigger the error are forgetting to #include <config.h> at the
top.  Every PSPP source file should #include <config.h> as the
first thing it does.

As for when to use restrict: restrict is a little like const in
that you can choose to use it or not; if you do, you can
potentially get some benefits, otherwise you probably don't lose
too much.  I imagine that the gnulib folks use them for functions
in <string.h> because C99 prescribes the exact prototypes for
those functions, including the use of restrict in some cases.
"GNU does not eliminate all the world's problems,
 only some of them."
--Richard Stallman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]