On 2 February 2015 at 12:05, Maxim Uvarov <[email protected]> wrote:
> On 01/29/2015 01:39 PM, Ola Liljedahl wrote:
>>
>>         num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
>> -       odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
>> +       size_t bufsz = sizeof(cpumaskstr);
>> +       (void)odp_cpumask_to_str(&cpumask, cpumaskstr, &bufsz);
>>
>
>
> why did add this (void)?
Because odp_cpumask_to_str() has a return value that you normally
should check. If I think the return value for some reason doesn't
merit checking, then I cast the function call to "(void)".

If you are closing a file/socket descriptor you have written to, you
should check the return value from close() because writes may have
been buffered and close may fail writing out your data.. But if the
file descriptor was e.g. only used for reading, then you don't need to
check the return value from close(). Ideally the compiler should warn
if you are not checking the return value from close() and in the
second case above, you would use "(void)close(fd);".

I think the compiler can warn if return values are not used. Possibly
this is controlled using some GCC attribute.

BTW: This patch series is obsolete, I am currently rebasing it.


>
> Maxim.
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to