User: Password:
|
|
Subscribe / Log in / New account

Reitter: Answering the question: "How do I develop an app for GNOME?"

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 12, 2013 20:21 UTC (Tue) by nybble41 (subscriber, #55106)
In reply to: Reitter: Answering the question: "How do I develop an app for GNOME?" by mgedmin
Parent article: Reitter: Answering the question: "How do I develop an app for GNOME?"

The -Wno-unused-result option does exactly the opposite of what is wanted: it turns off the warning which would otherwise be issued for functions which have been tagged with __attribute__((warn_unused_result)). You still have to tag specific functions whose results should not be ignored. There does not appear to be an option to enable the warning for all non-void functions by default.


(Log in to post comments)

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 12, 2013 21:03 UTC (Tue) by mpr22 (subscriber, #60784) [Link]

Enabling the warning for all non-void functions by default leads to code being liberally salted with futile error-checking and/or casts-to-void.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 12, 2013 22:56 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

Futile?

Nope. Apart from maybe printf() - most of the error checking is necessary for secure code.

It just shows that exception handling is really much better than return codes when you want something that's reliable _and_ easy to read.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds