• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: IDE/ Command Line - failing on ignored return value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDE/ Command Line - failing on ignored return value


  • Subject: Re: IDE/ Command Line - failing on ignored return value
  • From: glenn andreas <email@hidden>
  • Date: Thu, 4 May 2006 10:24:10 -0500


On May 4, 2006, at 9:59 AM, Tommy Nordgren wrote:

Is there any command line option/ IDE setting that can be used to fail the build,
or at least give a warning if return values are ignored in C++ and C?

Are you really sure you want such a thing? Are you, for example, using the return values from all of your printfs? strcat/strcpys? memsets? fclose?


Basically almost all of the standard C library routines return a value - making sure to not ignore them would, at best, needlessly clutter your app (or alternately, flood your build log with "false positive" warning messages, obscuring any useful ones).

(I vaguely seem to remember it is because of this that such a warning does not exist, but that's one of those "back in the distant past" memories)

For specific cases, however, I believe you can do something like:

void* foo(int param1, int param2) __attribute__ ((__warn_unused_result__));

and thus indicate that this specific routine's return value should not be ignored (as opposed to checking all of them)



Glenn Andreas                      email@hidden
 <http://www.gandreas.com/> wicked fun!
quadrium | build, mutate, evolve | images, textures, backgrounds, art

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: IDE/ Command Line - failing on ignored return value
      • From: Paul Forgey <email@hidden>
References: 
 >IDE/ Command Line - failing on ignored return value (From: Tommy Nordgren <email@hidden>)

  • Prev by Date: Re: XCode Resource Files
  • Next by Date: Re: Linking debug/release app with debug/release framework?
  • Previous by thread: IDE/ Command Line - failing on ignored return value
  • Next by thread: Re: IDE/ Command Line - failing on ignored return value
  • Index(es):
    • Date
    • Thread