Re: Help converting NSFilePosixPermissions to Octal representation
Re: Help converting NSFilePosixPermissions to Octal representation
- Subject: Re: Help converting NSFilePosixPermissions to Octal representation
- From: "Michael Ash" <email@hidden>
- Date: Mon, 25 Aug 2008 22:45:04 -0400
On Mon, Aug 25, 2008 at 4:48 PM, Nate Weaver <email@hidden> wrote:
> Addendum: I guess the format should actually be %O (unsigned long) instead
> of %o (unsigned int) since it's defined as an unsigned long, though the
> upper bits probably won't be filled at all.
The problem is not whether the upper bits are used, but how the
arguments are passed.
In 32-bit land, longs and ints are identical and thus it makes no
difference which one you use.
In 64-bit land, longs are 64-bit but ints are only 32-bit. Depending
on the calling conventions being used (and I'm not familiar with Mac
OS X 64-bit vararg calling conventions) then having printf only grab
32 bits even though you're giving it 64 bits could cause some very
screwed up results. Hypothetically speaking it could even cause a
crash or corrupt memory, although realistically I doubt that would
happen in this case on any existing platform.
Mike
_______________________________________________
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