> On Oct 21, 2014, at 14:26 , Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Oct 21, 2014, at 13:33 , Rick Mann <rm...@latencyzero.com> wrote:
>> 
>> Honestly, though, I don't see why Swift can't just deal with "plain" enums.
> 
> Because it’s not an Obj-C compiler?
> 
> I suspect that the reason you saw the “incomplete” behavior is that you 
> declared the enum in two parts:
> 
>> enum McpSweepState
>> {
>>    MCP_SWEEP_UNKNOWN          = 0,
>>    MCP_SWEEP_EMPTY            = 1,
>>    MCP_SWEEP_ROTATING         = 2,
>>    MCP_SWEEP_PROCESSING       = 3,
>>    MCP_SWEEP_COMPLETE         = 4,
>>    MCP_SWEEP_CANCELED         = 5,
>>    MCP_SWEEP_ABORTED_PHYSICAL = 6,
>>    MCP_SWEEP_ABORTED_DATA     = 7,
>>    MCP_SWEEP_ERROR            = 8,
>> };
>> typedef enum McpSweepState McpSweepState;
> 
> Under this theory, Swift is able to parse the typedef, so it knows that 
> ‘McpSweepState’ is a type, and  maybeeven an enum, but it doesn’t know what 
> the values are. That might be enough to let it assign, but not to compare 
> (since == is not a built-in operator).
> 
> Or, it might be that it can parse the enum, but it doesn’t know its 
> underlying type, since you didn’t say ‘enum McpSweepState : NSUInteger’ or 
> some such.
> 
> Honestly, though, I don’t see why you can’t just deal with writing enums the 
> “compatible” way.

Because the file whence it comes is part of a library of C++ code that also has 
to run on Linux.


-- 
Rick Mann
rm...@latencyzero.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to