• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
omitting zero-test
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Permissions == Nightmare? Help Me
  • Next by Date: Re: omitting zero-test
  • Previous by thread: Permissions == Nightmare? Help Me
  • Next by thread: Re: omitting zero-test
  • Index(es):
    • Date
    • Thread