Skip to content

Fix some warnings regarding unused results and printf format

Summary

The first warning:

dune/uggrid/parallel/dddif/debugger.cc:568:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, 
  declared with attribute warn_unused_result [-Wunused-result] 

means, that the returned int is ignored. This int gives the information how many values are actually read into the buffer. If we ignore it, this would be potential source of memory access errors. So, we should check for the returned int. Just silencing the warning is not a good idea.

The second warning:

dune/uggrid/parallel/dddif/overlap.cc:727:22: warning: '0' flag used with ‘%p’ gnu_printf format [-Wformat=] 

is about the format specifier %08p that is used to format pointers with leading zeros. This is not defined by the standard. A leading zero for pointers is undefined behavior. It is, by accident - as stated in some developer forums - supported by some glibc implementations, though. For portability, the flag is replaced by a simple %p.

Edited by Simon Praetorius

Merge request reports

Loading