From http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
pure
return value depends only on the parameters and/or global variables.
Such a function can be subject to common subexpression elimination and
loop optimization just as an arithmetic operator would be. These
functions should be declared with the attribute pure. For example,
int square (int) attribute ((pure)); says that the hypothetical function square is safe to call fewer times than the
program says.
Some of common examples of pure functions are strlen or memcmp.
Interesting non-pure functions are functions with infinite loops or
those depending on volatile memory or other system resource, that may
change between two consecutive calls (such as feof in a multithreading
environment).
The attribute pure is not implemented in GCC versions earlier than
2.96.Many functions have no effects except the return value and their
Basically it is appended to functions which read global memory and do not modify anything. For eg, the strlen() function just reads the pointer and returns the length of the string, it doesn't modify the actual string.
On the other hand, strcpy() does modify the memory pointed to by one of the pointers.
Such attributes (pure, const etc) help the compiler to know some semantic meaning of a
function call, so that it can apply higher optimization than to normal
functions.
Read more from this lwn article: http://lwn.net/Articles/285332/
__attribute__((pure)), which you could have seen in the source code for yourself. So... ohse.de/uwe/articles/gcc-attributes.html#func-pure - Ed S.