December 18, 200817 yr So, you're stating that a bool is not an int, and that the result of the ! operator is not an int... and that the result of using ! on a non-zero value may not return a zero value?I'm saying what I previously said:I may be picky but the !-operator in principle works on boolean values not integers. I know that C isn't too particular about this but you never know!Using bool instead of int did solve the problem in the other thread: the Original Poster said so and he should know!Anyone with real experience of programming in a high-level language learns that not all compilers work in the same way and need various fixes. They also often implement things differently. My experience suggested that using bool might work and it did!C used the int type to represent boolean values before Standard ISO/IEC 9899:1999 in 1999. After that, C included a bool data type which takes the values true and false. This is a new typeand so is not an integer type. C++also has a bool data type. The Visual C++ Language Reference states:bool (C++)This keyword is a built-in type. A variable of this type can have values true and false. Conditional expressions have the type bool and so have values of type bool. For example, i!=0 now has true or false depending on the value of i. In Visual C++ 5.0 and later, bool is implemented as a built-in type with a size of 1 byte. http://msdn.microsoft.com/en-us/library/tf4dy80a(VS.80).aspxandLogical Negation Operator: !The logical negation operator (!) reverses the meaning of its operand. The operand must be of arithmetic or pointer type (or an expression that evaluates to arithmetic or pointer type). The operand is implicitly converted to type bool. The result is true if the converted operand is false; the result is false if the converted operand is true. The result is of type bool. http://msdn.microsoft.com/en-us/library/1k6w8551(VS.80).aspxSo I will say that bool is not an int, and that the result of the ! operator is not an int in VC 5.0 and later (and possibly other implementations) and it's poor programming practice to assume they are in any C++ implementation.Finally, as a reminder where this began, your wrong statement in the other thread that I corrected was:The ! operator performs a boolean operation of inverting each bit in the value. Gerry Howard
December 18, 200817 yr Moderator While you may at times be "technically correct," your arrogant, abrasive, abusive and combative attitude does not stand you well here at all "mgh."Apparently, your delight lies in the propensity to argue, rather than in the simple joy of providing correct information without rancor......in short, either you haven't the social skills for civil discourse, or deliberately choose not to use them.In all the years I've been a member here at AVSIM, seldom* have you ever offered anything to the community. In every case, your replies have been solely aimed at "correcting errors" of others with your acid tongue.That is sad.*EDIT: changed "not once" to "seldom" to account for two instance of actual help... Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
December 18, 200817 yr In all the years I've been a member here at AVSIM, not once have you ever offered anything to the community. In every case, your replies have been solely aimed at "correcting errors" of others with your acid tongue.That is sad.I offered the Original Poster in the other thread in this forum two possible solutions: the second of which worked for him and he thanked me for it. Neither were in a combative manner.First PostSecond PostWould you care to retract your statement? Gerry Howard
December 19, 200817 yr Moderator I offered the Original Poster in the other thread in this forum two possible solutions: the second of which worked for him and he thanked me for it. Neither were in a combative manner.First PostSecond PostWould you care to retract your statement?No, but I did edit the post to replace "not once" with "seldom" though. Two 'helpful' posts out of over two thousand isn't much to brag about though... :( Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
December 19, 200817 yr Hey! The new forums have an 'ignore user' feature... :( Best Regards,Robert Kerr 3D Modeler & Texture Artist
December 19, 200817 yr Two 'helpful' posts out of over two thousand isn't much to brag about though... :(You have, of course, checked all my other posts because otherwise that statement would still be untrue? that's a rhetorical question, so you needn't bother to reply. Gerry Howard
Create an account or sign in to comment