D - bit expression is not a boolean ??
- Mike Wynn (15/15) Aug 20 2003 is this a compiler bug ? v0.69 win32
- Walter (5/20) Aug 20 2003 This is not about bit types, but more about disallowing '=' as the opera...
- Derek Parnell (12/36) Aug 20 2003 Or maybe ..
- Mike Wynn (5/41) Aug 21 2003 able
- Philippe Mori (12/52) Aug 21 2003 Maybe we should extend if (and also while) such to allows the
- Derek Parnell (11/66) Aug 21 2003 Possibly, but I was thinking more along the lines of this ...
- Mike Wynn (9/62) Aug 21 2003 i've
- Matthew Wilson (11/23) Aug 29 2003 This is the ugly C++ workaround, but not good enough for D, methinks.
- Walter (6/31) Sep 12 2003 Nope.
is this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to be able to write the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }
Aug 20 2003
This is not about bit types, but more about disallowing '=' as the operator for a boolean test, due to it being usually a typo for '=='. "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:bi1me1$1n9p$1 digitaldaemon.com...is this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to be abletowrite the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }
Aug 20 2003
On Wed, 20 Aug 2003 23:21:09 -0700 (08/21/03 16:21:09) , Walter <walter digitalmars.com> wrote:This is not about bit types, but more about disallowing '=' as the operator for a boolean test, due to it being usually a typo for '=='. "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:bi1me1$1n9p$1 digitaldaemon.com...Or maybe .. int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2), dostuff ) { return 0; } return 1; } -- Derekis this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to be abletowrite the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }
Aug 20 2003
"Derek Parnell" <derek.parnell no.spam> wrote in message news:oprt8s4jv759ej19 news.digitalmars.com...On Wed, 20 Aug 2003 23:21:09 -0700 (08/21/03 16:21:09) , Walter <walter digitalmars.com> wrote:ableThis is not about bit types, but more about disallowing '=' as the operator for a boolean test, due to it being usually a typo for '=='. "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:bi1me1$1n9p$1 digitaldaemon.com...is this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to beI personally hate that form, like that it does not look too bad, but i've seen some "wonderful" uses of comma operator in if's in the past.toOr maybe .. int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2), dostuff ) { return 0; } return 1; }write the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }
Aug 21 2003
Maybe we should extend if (and also while) such to allows the following syntax (similar to for): if (declaration; condition) { } Otherwise yo can always do { declarations; if (condition) { } }ableThis is not about bit types, but more about disallowing '=' as the operator for a boolean test, due to it being usually a typo for '=='. "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:bi1me1$1n9p$1 digitaldaemon.com...is this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to beI personally hate that form, like that it does not look too bad, but i've seen some "wonderful" uses of comma operator in if's in the past.toOr maybe .. int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2), dostuff ) { return 0; } return 1; }write the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }
Aug 21 2003
On Thu, 21 Aug 2003 10:01:43 -0400 (08/22/03 00:01:43) , Philippe Mori <philippe_mori hotmail.com> wrote:Possibly, but I was thinking more along the lines of this ... As the form if ( <EXPRESSION> ) is valid then it might be just simple enough to do ... if ( (a = b) ) in other words, if the assignment expression is enclosed in its own parenthesis, it is considered to be a simple single-term expression, which does provided a valid boolean result. -- DerekMaybe we should extend if (and also while) such to allows the following syntax (similar to for): if (declaration; condition) { } Otherwise yo can always do { declarations; if (condition) { } }ableThis is not about bit types, but more about disallowing '=' as the operator for a boolean test, due to it being usually a typo for '=='. "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:bi1me1$1n9p$1 digitaldaemon.com...is this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to beI personally hate that form, like that it does not look too bad, but i've seen some "wonderful" uses of comma operator in if's in the past.toOr maybe .. int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2), dostuff ) { return 0; } return 1; }write the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }
Aug 21 2003
"Philippe Mori" <philippe_mori hotmail.com> wrote in message news:bi2j25$31bd$1 digitaldaemon.com...i'veableThis is not about bit types, but more about disallowing '=' as the operator for a boolean test, due to it being usually a typo for '=='. "Mike Wynn" <mike.wynn l8night.co.uk> wrote in message news:bi1me1$1n9p$1 digitaldaemon.com...is this a compiler bug ? v0.69 win32 int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2) ) { return 0; } return 1; } //bit_test.d(4): '=' does not give a boolean result after all the bit is bool postings etc, I would have expected to beI personally hate that form, like that it does not look too bad, buttoOr maybe .. int main( char[][] args ) { bit dostuff; if ( dostuff = (args.length > 2), dostuff ) { return 0; } return 1; }write the above code and not if ( (dostuff = (args.length > 2)) == true ) { return 0; }and how exactly is that better (or different) from if ( expr, var ) { .... } and for IS an extended while! my complaint was if ( bit_assign ) is an error I agree `if ( object_assign ) ...` or `if ( int_assign ) ...` are not `if ( boolean )` and thus an error (or potential error.seen some "wonderful" uses of comma operator in if's in the past.Maybe we should extend if (and also while) such to allows the following syntax (similar to for): if (declaration; condition) { } Otherwise yo can always do { declarations; if (condition) { } }
Aug 21 2003
Maybe we should extend if (and also while) such to allows the following syntax (similar to for): if (declaration; condition) { }Wow, I thought it did support this! It must do.Otherwise yo can always do { declarations; if (condition) { } }This is the ugly C++ workaround, but not good enough for D, methinks. Another imperfection in C++ is the fact that you can declare variables of only one type in a for statement. We would like to be able to do the following in D: for(int i = 0, j, k = 0, long l = 0, m, n = 0; ...) { } // i, j, k, l, m, n all cease to exist here Walter, does this present any serious problem for the parser? (I'm assuming it'd be a breeze for a man of your talent.)
Aug 29 2003
"Matthew Wilson" <matthew stlsoft.org> wrote in message news:biojkj$ah0$1 digitaldaemon.com...Nope.Maybe we should extend if (and also while) such to allows the following syntax (similar to for): if (declaration; condition) { }Wow, I thought it did support this!It must do.Why?assumingOtherwise yo can always do { declarations; if (condition) { } }This is the ugly C++ workaround, but not good enough for D, methinks. Another imperfection in C++ is the fact that you can declare variables of only one type in a for statement. We would like to be able to do the following in D: for(int i = 0, j, k = 0, long l = 0, m, n = 0; ...) { } // i, j, k, l, m, n all cease to exist here Walter, does this present any serious problem for the parser? (I'mit'd be a breeze for a man of your talent.)There are some ambiguity problems using typedef'd names after the ,.
Sep 12 2003