omitting zero-test
omitting zero-test
- Subject: omitting zero-test
- From: matt neuburg <email@hidden>
- Date: Thu, 20 Feb 2003 08:55:49 -0800
This is an elementary question, but it sure caught me flat-footed so I thought I'd ask. Why doesn't this work properly?
BOOL ticketOrder =
([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask);
It only works if I explicitly test for zero:
BOOL ticketOrder =
(([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0);
I'm one of those lazy C coders who never in his life has written !=0 or !=nil, so I was very surprised by this. Does it have something to do with the fact that the integer returned by modifierFlags is unsigned? Thx - m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.