[swift-users] Importing NSUInteger in my own Objective-C Code as Int

Chris Lattner clattner at apple.com
Mon Jan 18 13:32:41 CST 2016


On Jan 18, 2016, at 1:15 AM, Marco Masser <lists at duckcode.com> wrote:
> 
>> On 2016-01-17, at 22:01, Chris Lattner <clattner at apple.com <mailto:clattner at apple.com>> wrote:
>> 
>>> On Jan 15, 2016, at 10:19 AM, Jens Alfke via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>> 
>>>> On Jan 15, 2016, at 5:19 AM, Marco Masser via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>>> 
>>>> Swift imports NSUInteger in Objective-C APIs as Int, but only for Frameworks like Foundation and AppKit. For other code, NSUInteger is imported simply as UInt.
>>> 
>>> Really? I’d never noticed that. It seems wrong to me, since NSUInteger is clearly an unsigned type, so it should map to Uint.
>> 
>> Yes, it is intentional, we do the same for size_t.
>> 
>> As far as I know, there is no way to get the same behavior for your own code.  It would be reasonable to introduce a clang attribute for that though.
> 
> Should I file a request for that somewhere?

Sure.  bugs.swift.org <http://bugs.swift.org/> is a good place for it.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160118/c469a085/attachment.html>


More information about the swift-users mailing list