On 02/02/2015 02:35 PM, Ola Liljedahl wrote:
On 2 February 2015 at 12:26, Maxim Uvarov <[email protected]> wrote:
On 02/02/2015 02:18 PM, Ola Liljedahl wrote:
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)".
In current repo it's void:
void odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int len);
Yes but the patch changed that. The formatting can fail because the
specified output buffer is too small. So the call needs a return
value.
Ah, ok. Somehow I skipped that and was surprised casting from void to void.
Patch looks good.
Maxim.
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