Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help converting NSFilePosixPermissions to Octal representation



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Help converting NSFilePosixPermissions to Octal representation (From: "Charles E. Heizer" <email@hidden>)
 >Re: Help converting NSFilePosixPermissions to Octal representation (From: Nate Weaver <email@hidden>)
 >Re: Help converting NSFilePosixPermissions to Octal representation (From: Nate Weaver <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.