• 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: XCode 2.2: warning: 'i' may be used uninitialized in this function.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode 2.2: warning: 'i' may be used uninitialized in this function.


  • Subject: Re: XCode 2.2: warning: 'i' may be used uninitialized in this function.
  • From: Lawrence Gold <email@hidden>
  • Date: Fri, 11 Nov 2005 09:03:43 -0700


On Nov 11, 2005, at 6:38 AM, Robert Tillyard wrote:

I'm getting a warning from XCode 2.2 that 'i' could be used un- initialised in the function below.

bar() returns zero if it fails or returns 1 on success and sets 'i' to a value.

Is this really an issue that XCode should treat as a warning? or has XCode analysed bar() and determined that I have an issue in bar () where I might return '1' without setting 'i'?

/Users/rob/Work/atMacXt/common.c:791: warning: 'i' may be used uninitialized in this function


void foo () { int i;

   if (!bar (&i))
      return;

   func (i);
}

It's probably complaining because you're passing a pointer to an uninitialized variable into bar, and it doesn't know at this point how &i is going to be used by bar. Simple fix:


	int i = 0;


_______________________________________________ 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
References: 
 >XCode 2.2: warning: 'i' may be used uninitialized in this function. (From: Robert Tillyard <email@hidden>)

  • Prev by Date: XCode 2.2: /usr/bin/ld: warning -prebind ignored because MACOSX_DEPLOYMENT_TARGET environment variable greater or equal to 10.4
  • Next by Date: Re: Xcode search Path
  • Previous by thread: XCode 2.2: warning: 'i' may be used uninitialized in this function.
  • Next by thread: Re: XCode 2.2: warning: 'i' may be used uninitialized in this function.
  • Index(es):
    • Date
    • Thread