unlikely compiler flag propagation

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

 



Hi all,

I have a question about the unlikely compiler flag.
When a called function is only returns an error with the unlikely flag
set, should I set the unlikely compiler flag for the return value
check in the callee as well?

For example:

int function_one(int *list, int num_elements)
{
    int i;
    for (i =0; i < num_elements; i++) {
        if (unlikely(check_element(list + i)))
           return 1;
    }

[...]

    return 0;
}

int function_two(...)
{
[...]

     if (function_one(list, num))
         return -1;
}


So my question is, if function_two should instead implement:
if (unlikely(function_one(list, num))

Or does the unlikely compiler flag propagate to calling functions?

Thanks a lot,
Matthias
-- 
motzblog.wordpress.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux