[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: RFC: warnings on ignoring return value on some list operations
From:       mortenw () gnome ! org (Morten Welinder)
Date:       2005-11-29 0:38:37
Message-ID: 200511290038.jAT0cbw09448 () troll ! rentec ! com
[Download RAW message or body]


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
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic