• 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
Xcode incorrect 'uninitialized' warning?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Xcode incorrect 'uninitialized' warning?


  • Subject: Xcode incorrect 'uninitialized' warning?
  • From: Carl Hoefs <email@hidden>
  • Date: Tue, 07 Feb 2017 15:46:28 -0700

Xcode 8.2.1

Why does Xcode flag the indicated line with a warning? Is this saying the compiler has no introspection into the CPTImageSlices struct since it could have any combination of initialized/uninitialized elements?

-Carl


    typedef struct _CPTImageSlices {
        CGImageRef slice[9];
    }
    CPTImageSlices;

    

    @property (nonatomic, readwrite, assign) CPTImageSlices slices;



    -(void)setEdgeInsets:(CPTEdgeInsets)newEdgeInsets
    {
        if ( !CPTEdgeInsetsEqualToEdgeInsets(edgeInsets, newEdgeInsets) ) {
            edgeInsets = newEdgeInsets;

            

            CPTImageSlices imageSlices;

            

            for ( NSUInteger i = 0; i < 9; i++ ) {
                imageSlices.slice[i] = NULL;
            }

            

            self.slices = imageSlices;  //<-- warning here
        }
    }

    -(void)setSlices:(CPTImageSlices)newSlices
    {
        for ( NSUInteger i = 0; i < 9; i++ ) {
            CGImageRelease(slices.slice[i]);

            

            slices.slice[i] = CGImageRetain(newSlices.slice[i]);
        }
    }


Warning: Variable 'imageSlices' may be used uninitialized here
 _______________________________________________
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: Xcode incorrect 'uninitialized' warning?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: iOS datatype size change in 10.x SDK?
  • Next by Date: Re: Xcode incorrect 'uninitialized' warning?
  • Previous by thread: Re: iOS datatype size change in 10.x SDK?
  • Next by thread: Re: Xcode incorrect 'uninitialized' warning?
  • Index(es):
    • Date
    • Thread