Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22031

VAlue/Purpose of __attribute((const)) in gcc c++

$
0
0

Is there any value in using __attribute((const)) in gcc for c++ programs when declaring functions or static members that the compiler can see do not access global memory?

For example,

int Add( int x , int y ) __attribute((const))
{
    return x+y;
}

The compiler knows that this function is limited in its scope of memory access. Does the attribute add anything? If so, what?

Thanks,

Josh


Viewing all articles
Browse latest Browse all 22031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>