[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ? assignments are not expressions ?
- From: "Steve Williams" <stevewilliams@...>
- Date: Mon, 26 Mar 2001 13:05:50 +1000
That's also a bad habit that many C programmers have picked up. The better
C compilers (Visual C++ is not included in that category) give warnings when
they come across that kind of syntax. Sure, technically it's a valid
construct, but it is not regarded as good programming practise these days.
Steve 'Sly' Williams - Code Monkey - http://www.kromestudios.com
> I expected to be able to do:
>
> while ( X = read() )
> do
> print ( X )
> end
>
> But it seems I must do:
>
> X = read()
> while X
> do
> print ( X )
> X = read()
> end
>
> Shouldn't an assignment be an expression
> evaluating to the value assigned? It seems
> this could be done without breaking anything...?
>
> -Tom
>