Re: RFC: warnings on ignoring return value on some list operations



It's remarkably non-trivial to say what "used" mean for this
attribute when your intention is to silence the warning.

Works:

  do { if (func ()); } while (0);
  func () || 0;
  func () ? 0 : 1;
  func () == 0;
  !func ();

Does not work:

  (void)func ();
  func () || 1;
  func () ? 1 : 1;
  (void)(0 + func ());

(Assuming the result type is something that can be treated as a
boolean value.  Apart from full structures that should be ok.)

Since this is probably compiler version dependent, we might need
a G_NO_REALLY_I_DONT_WANT_TO_USE_IT macro.

Morten



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