Asked • 05/21/19

Logic: is ( A && !(B || C)) || ( B || C ) the same as ( A || B || C )?

I've encountered some obj-c code and I'm wondering if there's a way to simplify it: #if ( A && !(B || C)) || ( B || C ) is this the same as? #if ( A || B || C ) If not, is there another way to formulate it that would be easier to read? [edit] I tried the truth table before asking the question, but thought I had to be missing something because I doubted that Foundation.framework/Foundation.h would employ this more complex form. Is there a good reason for it? Here's the original code (from Foundation.h): #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.