|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
D - Assignments - preconditional
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 and 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...It's basically like a macro except you don't need a #define statement 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. Feb 05 2002
|