On Oct 12, 2006, at 12:57 PM, [EMAIL PROTECTED] wrote:



-------------- Original message --------------
From: John Kubie <[EMAIL PROTECTED]>

why i++ is clearer than i=i+1

In general basic and computer languages try to approximate english
sentences. I certainly use english approximations when I program.

i++ has no assigment so that gact taht it's doing one is not clear/
Secondly logically it could just as easily mean i =  i+i. for example.
That it means increment the varible by one is only a C convention and has no intrinsic meaning where as IMO i = i + 1 does.

The most confusing part of the RB idiom for increment is that a beginner often sees that as an check for equality and of course it's not. Pascal solved that with a different operator for assignment and equality. C did as well but they went and made them so similar AND usable as either that it's a common source of grief

Who has never seen a C bug based on code like

        if ( x = y )
        
which likely should read

        if ( x == y )

the problem is the author may actually have meant to do the assignment AND check for non zero with the first and thus the source of odd bugs from this construct
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to