C++ keyword search for the functions
a few months ago I read something ABOUT a certain key word that I can not find.
The principle was that if a function depends solely on its parameters (not rand, or dependence on time or on a variable-volatile), the compiler could save the result in memory to optimize the next call.
Code:
int foo (int a)
(
return a + 2;
)
void main ()
(
foo (5);
foo (5);
)
foo here would be called once the 2nd time and the result is already in memory.
In my memory function was called 'pure' but looking on this key word I do not think 'pure virtual' ...
Re: C++ keyword search for the functions
You can wrap each attribute in a macro and vary according to the macro compilos.
Re: C++ keyword search for the functions
Under gcc you __attribute__ ((pure)) and __attribute__ ((const)), but otherwise nothing portable.
You can wrap each attribute in a macro and vary according to the macro compilos.