• 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
Warning different width?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warning different width?


  • Subject: Warning different width?
  • From: Hans van der Meer <email@hidden>
  • Date: Mon, 24 Dec 2007 12:19:37 +0100

I made a category on NSNumber for working with unichar's:

.... NSHMNumberAdditions.h ....
#import <Foundation/Foundation.h>
/*!
@method numberWithUnichar:
@abstract ....
*/
+ (NSNumber *) numberWithUnichar: (unichar) character;

.... NSHMNumberAdditions.c ....
#import "NSHMNumberAdditions.h"
@implementation NSNumber (NSHMNumberAdditions)
+ (NSNumber *) numberWithUnichar: (unichar) character; {
	return [NSNumber numberWithUnsignedShort: character];
}
....

But then XCode gives me the following WARNING on the line with the return:

warning: passing argument 1 of 'numberWithUnsignedShort:' with different width due to prototype

In the documentation I read for NSNumber:

Creates and returns an NSNumber object containing a given value, treating it as an unsigned short.
+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value


while in NSString.h (included through Foundation.h) the unichar is defined by:

typedef unsigned short unichar;

It escapes me what is wrong here. Do I miss something or is perhaps the compiler overcautious here?


Hans van der Meer



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Warning different width?
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: NSKeyValueChangeNewKey returning NSNull, partially solved
  • Next by Date: Re: fast enumeration puzzlement
  • Previous by thread: Re: NSTreeNode -representedObject not KVC-Compliant
  • Next by thread: Re: Warning different width?
  • Index(es):
    • Date
    • Thread