D - Assignments - preconditional
- Brian Bober (28/28) Feb 03 2002 I was following the assignment thread and decided to start a new thread
- Pavel Minayev (7/22) Feb 04 2002 it
- Sean L. Palmer (9/33) Feb 04 2002 Well, IMO Brian's is ugly and smells strongly of kludge.
- Walter (3/7) Feb 05 2002 That's already the case in D.
I was following the assignment thread and decided to start a new thread since it was getting cluttered. I have an idea that I hope everyone will agree with. Assignments should not be allowed inside conditionals. Before a conditional, we could have a pre-conditional statment. It's basically like a macro except you don't need a #define statement and it only lasts until the first conditional. It would also follow all the variable naming rules except for having a $ in front. for instance: typedef bit[8] byte; byte c=0; byte b=0; byte a=100; $a : b=c*2; while (a != $a) { c+=1; } would be this in c++: unsigned char c=0; unsigned char b=1; unsigned char a=100; while (a != b=c*2) { c+=1; }
Feb 03 2002
"Brian Bober" <netdemonz yahoo.com> wrote in message news:a3ldkd$ndc$1 digitaldaemon.com...It's basically like a macro except you don't need a #define statement anditonly lasts until the first conditional. It would also follow all the variable naming rules except for having a $ in front. for instance: typedef bit[8] byte; byte c=0; byte b=0; byte a=100; $a : b=c*2; while (a != $a) { c+=1; }Well... int d = (b = c * 2); while (a != d) ... =)
Feb 04 2002
Well, IMO Brian's is ugly and smells strongly of kludge. Pavel, your replacement doesn't do the same thing. I don't mind assignments in conditionals, but they should be explicitly converted to bool (bit) or the compiler should at least issue a warning. Sean "Pavel Minayev" <evilone omen.ru> wrote in message news:a3lkel$shg$1 digitaldaemon.com..."Brian Bober" <netdemonz yahoo.com> wrote in message news:a3ldkd$ndc$1 digitaldaemon.com...andIt's basically like a macro except you don't need a #define statementitnamingonly lasts until the first conditional. It would also follow all the variablerules except for having a $ in front. for instance: typedef bit[8] byte; byte c=0; byte b=0; byte a=100; $a : b=c*2; while (a != $a) { c+=1; }Well... int d = (b = c * 2); while (a != d) ... =)
Feb 04 2002
"Brian Bober" <netdemonz yahoo.com> wrote in message news:a3ldkd$ndc$1 digitaldaemon.com...I was following the assignment thread and decided to start a new thread since it was getting cluttered. I have an idea that I hope everyone will agree with. Assignments should not be allowed inside conditionals.That's already the case in D.
Feb 05 2002