News for hackers. Stuff that matters.
Re:Functional Programming in C++ by copx on Friday April 27, 2012 @02:07AM (#3897792)
"pure" and "const" are GCC function attributes which are supposed to help the optimizer. Confusingly enough "const" demands a higher level of purity than "pure"..

I would never use those attributes except - maybe - in the most critical loops and then only with a big "WARNING!!!" sign. Why? GCC does not / cannot enforce the guarantees given by "const" and "pure" yet the optimizer always assumes they are true. I.e. accidentally reduce the purity of a function decorated in this way.. and you might create very hard to find bugs.

This is a general problem in C and C++, those languages simply weren't designed to enforce such contracts. C99's "restrict" has the same problem.

Re:Functional Programming in C++ by jhasse on Friday April 27, 2012 @10:11AM (#3899090)
Since when is "const" a GCC function attribute?
Re:Functional Programming in C++ by scott_s on Friday April 27, 2012 @10:44AM (#3899240)
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

This is, of course, in addition to its other meanings in the language.