On Tue, Oct 14, 2014 at 9:27 AM, Thomas Zander <tho...@thomaszander.se> wrote: > On Tuesday 14. October 2014 04.34.16 Pieter Wuille wrote: >> This means that scripts that use booleans as inputs will be inherently >> malleable. > > I've ran into this issue in C++ often enough, > a funny example is assigning "2" to a native c++ bool and then you can do a > if (myBool == true) > else if (myBool == false) > and neither of them will hit.
Off topic nit: I think you're confused with custom BOOL typedefs in C? C++ booleans are protected against this (C++ standard ยง4.7/4 according to Google).: ``` #include <stdio.h> int main() { bool myBool; myBool = 2; if (myBool == true) printf("It is true!\n"); else if (myBool == false) printf("It is false!\n"); else printf("It is something else!\n"); } ``` Prints 'It is true'. You can also use bool(something) as equivalent of `x != 0`; as in `assert(bool(2) == true);`. Wladimir ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development