I'd like to add an inverse definition to an existing BOOL/bool type, one which 
the compiler is natively aware of.

Example:
bool isSystemOpen;

I can reference this in the manner in which it's defined:
if (isSystemOpen)
if (!isSystemOpen)

However, there are times when it's more desirable to reference it in the 
opposite manner as it makes more logical sense to humans.

The compiler is aware of the boolean nature of that variable, so I would like 
to be able to create a new form which is aware of the inverse boolean condition 
natively.

Example syntax:
bool isSystemOpen[.isSystemClosed.];

This new syntax creates one physical variable, and two logical ways to 
reference the same variable in memory, but always tests for the inverse 
condition correctly, such as:
if (isSystemClosed)

Which would be the same logically as:
if (!isSystemOpen)

Any ideas on how to best / easily implement this? :-)  I had the idea of just 
writing a pre-processor to look for those references and swap them out with the 
opposite condition.  But it seems GCC should be able to do this natively.

Thanks.

Best regards,
Rick C. Hodgin

Reply via email to