title: Format specifies type ‘int’ but the argument has type ‘float’
body: <p>If I define a constant as an integer, how is it recognised as a float ?</p>
  
  <p>I built and ran the code below without problems under Xcode 6.1.1. The problem only appeared after I upgraded to Xcode 7.2 (7C68) and El Capitan.</p>
  
  <pre><code>iOSCircleView.m
  
  int   const SECTORS_80 = 80;
  
  
  @implementation iOSCircleView
  
  - (void)ViewSettings_OverView       {
  
      sectors = SECTORS_80;
  
          NSLog(@"sectors %i", sectors);
    } 
  </code></pre>
  
  <p>When I run it NSLog reports a warning </p>
  
  <blockquote>
    <p><strong>Format specifies type ‘int’ but the argument has type ‘float’</strong></p>
  </blockquote>
  
  <p>The console displays</p>
  
  <blockquote>
    <p>2016-01-07 10:05:00.210 AutoDrawUI[1298:555384] <strong>sectors 855670784</strong></p>
  </blockquote>
  
  <p>If I change NSLog command to </p>
  
  <pre><code>    NSLog(@"sectors %f”, sectors);
  </code></pre>
  
  <p>and rerun the code, there is no warning but the console displays</p>
  
  <blockquote>
    <p>2016-01-07 10:38:01.547 AutoDrawUI[1330:632806] <strong>sectors 80.000000</strong></p>
  </blockquote>
  
  <p>This seems like a bug. But maybe I’ve missed something</p>
  
  <p><strong>Here is the Original Code</strong></p>
  
  <pre><code>int   const SECTORS_80          = 80;
  
  @implementation iOSCircleView
  
  // Initialisation
  
  // frame a view for drawing
  
  - (id)initWithFrame:(CGRect)frame   {
      self = [super initWithFrame:frame];
      if (self) {
  
          // Initialization code
          totalCircles            = [[NSMutableArray alloc] init];
          centre                  = [[NSMutableArray alloc] init];
          ring                    = [[NSMutableArray alloc] init];
  
          // Set background color
          self.backgroundColor    = [UIColor grayColor];
  
      }
      return self;
  }
  
      // initialise single target view (7 others are commented out)
  
  - (void)drawRect:(CGRect)rect       {
  
      [self ViewSettings_OverView];           // 1. "launch view" ??
  
  } 
  </code></pre>
  
  <p>Running (note: the problem occurs before it gets here)</p>
  
  <pre><code>    // run
  
  - (void)autoDrawUI                  {
          [self drawCircle];
  }   
  </code></pre>
  
  <p>Here is the full class (unedited)</p>
  
  <pre><code>     // initialise display settings
  
  - (void)ViewSettings_OverView       {
  
      viewState = 0;
      // number of dots on perimeter
      sectors         = SECTORS_80;             // WARNING HERE
      limit           = sectors;;
  
      if (sectors &lt;= 0) {                       // WARNING HERE
  
          show        = FALSE;                  // disable
      } else
          show        = TRUE;                   // enable perimeter dots
  
      // radius of large circle perimeter
      uberRadius      = UBERRADIUS_52;
  
      // radius of dots on large circle perimeter
      dotRadius       = DOTRADIUS_4;
  
      dotsFilled      = TRUE;                // outline
      oneColour       = TRUE;                // every colour
      alternateDots   = TRUE;                // alternately filled and coloured
  
      oddEvenState    = 1;                    // PlayView
  
      ringDot         = RINGDOT_HIDE;       //_SHOW104
      centreDotFilled = FALSE;                // fill or outline
  
      centreDot       = CENTREDOT_HIDE;       //CENTREDOT_SHOW26;
      centreDotFilled = TRUE;                 // fill or outline
  
          NSLog(@"View %i", viewState);
          NSLog(@"sectors %i", sectors);      // WARNING HERE
          NSLog(@"show %i", show);
      [self centreReference];
  
  }
  </code></pre>
  
  <p>And here is the .h file</p>
  
  <pre><code>    #import &lt;UIKit/UIKit.h&gt;
  
  @interface iOSCircleView : UIView
  {
      NSMutableArray  *totalCircles;
      NSMutableArray  *sectorDots;
  
      //                                      following Stackoverflow 08/02/2015 ?
      NSMutableArray  *centre;                // 1 of 5 (Global View), centre (Wait View), even bell icon (Play View)
      NSMutableArray  *ring;                  // odd bell icon (Play View)
                                              //      TO DO
      NSMutableArray  *sectorDotsCyan;        // 16 moons surround 1 of 5 buttons on Global View
      NSMutableArray  *sectorDotsRed;         // 16 moons          2
      NSMutableArray  *sectorDotsYellow;      // 16 moons          3
      NSMutableArray  *sectorDotsMagenta;     // 16 moons          4
      NSMutableArray  *sectorDotsGreen;       // 16 moons          5
  
      int             dotCount,               // working
                      colourIndex,            // working
                      toggleIndex,            // working
                      imageIndex,
                      limit,                  // working
                      selectedZone,           // working
                      selectedPhone,
                      selectedState,
                      state,
                      viewState,              // working
                      ringDotFilled,
                      centreDotFilled,        // working
                      dotsFilled,             // working
                      labelShown,
                      oneColour,              // working
                      alternateDots,
                      i,                      // working
                      show;                   // working
  
      BOOL            shakeTap,               // PlayView
                      oddEvenPhone,           // LocalView
                      oddEvenState;           // working
  
      float           uberX,                  // working
                      uberY,                  // working
                      uberRadius,             // working
                      uberAngle,              // working
                      labelX,
                      labelY,
                      dotRadius,              // working
                      sectors,                // working
                      x,                      // working
                      y,                      // working
                      ringDot,                // working
                      centreDot,              // working
                      textOffset,             // working
                      startAngle,
                      dotAngle,
                      endAngle,
                      angle;
  
      CGPoint         dotPosition;
      CGRect          boxBoundary;
      CGContextRef    context;
  }
  
  @property(nonatomic,retain) UIColor* fillColor;
  @property(nonatomic,retain) UIColor* circle;
  @property(nonatomic,retain) UIImage* anImage;
  
  
  - (void)drawCircle;
  - (void)drawRosette;
  
  @end
  </code></pre>
  
  <p>... and the problem becomes immediately obvious. I declared sectors as float and somehow how I got away with this previously. My brain's still on holiday!</p>