Re: compiler warning when attempting to save hex value in char in reusing it
Re: compiler warning when attempting to save hex value in char in reusing it
- Subject: Re: compiler warning when attempting to save hex value in char in reusing it
- From: Charles Steinman <email@hidden>
- Date: Tue, 4 Sep 2007 17:19:54 -0700 (PDT)
--- Sebastian Pape <email@hidden> wrote:
> I've been working with XCode and Cocoa for a few
> days now and got a little
> stuck with a problem:
> char seq = 0x02;
> NSMutableData *sequence = [[NSMutableData alloc]
> init];
> [sequence appendBytes:seq length: 1];
>
>
> I always get a warning from the compiler telling me:
> warning: passing
> argument 1 of 'appendBytes:length:' makes pointer
> from integer without a
> cast
It's telling you precisely what's wrong: The method
expects a pointer, but you're giving it a character
value. If you want to append the contents of seq to
the data, it should be [sequence appendBytes:&seq
length:1].
Cheers,
Chuck
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
_______________________________________________
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