I agree, the language (and its many derivatives) is littered with silliness like that.I can't think of an application in C where using = deliberately in an if statement is in any way consistent with writing clear and easy-to-follow software.
I agree, the language (and its many derivatives) is littered with silliness like that.I can't think of an application in C where using = deliberately in an if statement is in any way consistent with writing clear and easy-to-follow software.
Better silly than unsuitable.I agree, the language (and its many derivatives) is littered with silliness like that.
Would you prefer Pascal?Using = for assignment was a poor decision really, right there is where stuff started go down the wrong path.
A statement like
a = a + 1
is nonsensical, mathematically false.
Something's in software that directly interfaces with hardware are neither clear, well structured or easy to follow. That's what code comments are for.I can't think of an application in C where using = deliberately in an if statement is in any way consistent with writing clear and easy-to-follow software.
it would have to be a:=a+1, because my keyboard doesn't have a ←.Would you prefer Pascal?
a := a + 1
or APL?
a ← a + 1
Examples were given earlier in the thread.I can't think of an application in C where using = deliberately in an if statement is in any way consistent with writing clear and easy-to-follow software.
These are options of course. C was created at a time when ASCII (and IBM's EBCDIC) was the only choice, today we have Unicode so the APL-like arrow is now a no-brainer. I designed a grammar a year ago, and incorporated optional Unicode symbols for several operators, like rotate left/right, assignment ( ⇐ ), XOR and so on, because there's no longer any good reason not to do so.Would you prefer Pascal?
a := a + 1
or APL?
a ← a + 1
Yes you're right, we shouldn't be pedantic, we're all used to this too by now. This reminds me though of a gripe I have about many assembly languages. Too many use MOV when in reality COPY is a better term, I've had intelligent people literally get confused, thinking that MOV implies the bits go from one place to another with the source bits then getting automatically set to all zeroes, COPY would be so much better.One should not be too pedantic over the meaning of an innocent looking expression such as:
a = a + 1
In other programming languages, it could take on a much different meaning. For example, what would be the outcome if a were a character string, array, matrix?
I'm a huge admirer of APL and Iverson, like LISP every aspiring programmer should spend time with APL to enhance how one perceives problems, data and solutions. I used APL regularly in the 1980s, it was available on our IBM mainframe with dedicated keyboard too.Have a look at the APL operators. APL was invented by a mathematician Kenneth E. Iverson in the 1960s using mathematical notation.
For example,
!A is factorial of A
A ! B is number of combinations of B in A.
Like what? C often obfuscates one's intent, makes the simple look complex, take the language's approach to strings for example, concatenation is silly.Something's in software that directly interfaces with hardware are neither clear, well structured or easy to follow.