Re: Add corollary extension

2012-06-29 Thread Joe Buck
On Thu, Jun 28, 2012 at 12:39:16PM -0700, Rick Hodgin wrote: > I've thought more about the syntax, and I see this making more sense: > bool isSystemOpen[!isSystemClosed]; You've just declared an array of bool, whose size is the expression !isSystemClosed. As developers have already showed you ho

Re: Add corollary extension

2012-06-29 Thread Andrew Haley
On 06/28/2012 08:39 PM, Rick Hodgin wrote: >> 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

Re: Add corollary extension

2012-06-28 Thread Rick C. Hodgin
nnett Sent: Thu, Jun 28, 2012 06:24 PM To: Rick C. Hodgin CC: Jonathan Wakely ; gcc Subject: Re: Add corollary extension >On Thu, Jun 28, 2012 at 3:08 PM, Rick C. Hodgin wrote: >> How would you handle: >> >> isSystemClosed = true; > >A good clean error message is

Re: Add corollary extension

2012-06-28 Thread James Dennett
On Thu, Jun 28, 2012 at 3:08 PM, Rick C. Hodgin wrote: > How would you handle: > > isSystemClosed = true; A good clean error message is ideal, and should be easy. (A proxy object such as inv_bool can do this easily enough, but it's still going to hurt readability.) > You're getting into nasty

Re: Add corollary extension

2012-06-28 Thread Oleg Endo
On Thu, 2012-06-28 at 18:08 -0400, Rick C. Hodgin wrote: > How would you handle: > > isSystemClosed = true; By adding one line to inv_bool struct inv_bool { bool& b; operator bool() const { return !b; } inv_bool& operator = (bool _b) { b = !_b; return *this; } }; Cheers, Oleg

Re: Add corollary extension

2012-06-28 Thread Rick C. Hodgin
CC: Jonathan Wakely ; gcc Subject: Re: Add corollary extension >On Thu, Jun 28, 2012 at 12:39 PM, Rick Hodgin wrote: >>> Why do you want to bother with a non-standard, >>> unportable extension instead of just writing: >>> >>> inline bool isSystemClosed() &g

Re: Add corollary extension

2012-06-28 Thread James Dennett
On Thu, Jun 28, 2012 at 12:39 PM, Rick Hodgin wrote: >> 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

Re: Add corollary extension

2012-06-28 Thread Rick Hodgin
> 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 chan

Re: Add corollary extension

2012-06-28 Thread Jonathan Wakely
On 28 June 2012 17:00, Rick Hodgin wrote: > 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) >

Add corollary extension

2012-06-28 Thread Rick Hodgin
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 refer