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

Marco Masser lists at duckcode.com
Mon Jan 18 03:15:20 CST 2016


> On 2016-01-17, at 22:01, Chris Lattner <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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160118/97cae683/attachment.html>


More information about the swift-users mailing list