This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add corollary extension


> Why do you want to bother with a non-standard,
> unportable extension instead of just writing:
> 
> inline bool isSystemClosed()
> { return !isSystemOpen; }
> 
> Which is simple, conventional, easy to understand
> and portable.
> 
> Or in C++ just define a suitable type, instead of
> needing changes to the core language:
> 
> struct inv_bool {
> ? bool& b;
> ? operator bool() const { return !b; }
> };
> 
> inv_bool isSystemClosed = { isSystemOpen };

There are certain fundamentals in data processing.  The inverse bool is one of them.  Why not be able to reference it more naturally in code utilizing something the compiler already knows about and can wield effortlessly?

I've thought more about the syntax, and I see this making more sense:
bool isSystemOpen[!isSystemClosed];

As the inverse bool relationship is fundamental in software, I hope this will become a C/C++ standard.

Best regards,
Rick C. Hodgin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]