• 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
gcc "error: crosses initialization of 'OSStatus err'"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc "error: crosses initialization of 'OSStatus err'"


  • Subject: gcc "error: crosses initialization of 'OSStatus err'"
  • From: "Mark D. Gerl" <email@hidden>
  • Date: Wed, 17 Dec 2003 10:45:31 -0500

<NOTE_TO_APPLE>
Forgive me if this has been discussed, but the xcode-users list archive is
not searchable...FIX WEBSITE!
</NOTE_TO_APPLE>


I have lots of lazy initialization code...and unfortunately some code that
uses goto too.  For example:

    void foo(void* ptr)
    {
        require(ptr!NULL, ERROR);
        OSStatus err = SomeToolboxCall(..);
        ...
        ERROR:
        ...// note - err NOT used here
    }

I've figured out that because the require() macro uses goto to jump around
the initialization of err.  But Xcode/gcc makes this an error (NOT a
warning).  The annoying fix for this is the following (which takes away from
the whole point of lazy initialization):

    void foo(void* ptr)
    {
        OSStatus err = noErr;
        require(ptr!NULL, ERROR);
        err = SomeToolboxCall(..);
        ...
        ERROR:
        ...// note - err NOT used here
    }

I have too many of these cases to fix.  My question, is that if this
shipping code works fine in CodeWarror - is there a way I can disable this
error in XC - or change it to a warning not an error?

Thanks!

--
Mark D. Gerl, email@hidden
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: -dynamiclib vs -dynamic vs -dylib
  • Next by Date: Differing debug environment
  • Previous by thread: Re: find panel
  • Next by thread: Differing debug environment
  • Index(es):
    • Date
    • Thread