[PATCH] Add pure and const attributes to functions that need them

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

 



On 11/17/2011 04:06 PM, Maarten Bosmans wrote:
> -static pa_bool_t options_have_option(pa_alsa_option *options, const char *alsa_name) {
> +static PA_GCC_PURE pa_bool_t options_have_option(pa_alsa_option *options, const char *alsa_name) {

I have to admit my lack of knowledge here - but the PA_GCC_PURE and 
PA_GCC_CONST macros (and their gcc implementations) were new to me, so I 
had to read up on them.

Which leads me to the question - do you think there is any possibility 
that people change these functions, changing their purity status, 
without removing the PA_GCC_PURE, thereby causing hard to find bugs?
That risk would then have to be measured against the potential 
performance benefit. Maybe these should mostly be added at time critical 
pieces of code (or maybe this is what you've done)?

Also, wouldn't a modern compiler such as GCC be able to figure out the 
purity of a function itself, or is that just wishful thinking?

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux