W
Walter Roberson
Paul Hsieh said:I should
have said that many statements, or the statements in question have
side-effects.
I am having a bit of difficulty in coming up with computer languages
that do not have statements with side effects (this referring to your
context of saying that C is unusual in that, etc..) LISP might
qualify in that it is seriously debatable as to whether LISP has
statements at all. I have encountered some computer languages which
did not use the term 'statement' but which had something that had
exactly the same role. There are languages which officially have
nothing other than operators, or operators and comments
(befunge, mind-f*ck), though they certainly have side-effects.
There are procedural languages such as Prolog that might perhaps
properly said to have no 'statements', but I have yet to find
one of those which was so pure that it did not have I/O of -some-
sort, and thus side-effects.
With respect to the statement in question, which was of the form
if (assignment) DoWhatever;
then the assignment is an -expression-, not a statement, and
there are certainly if -statements- that have no side effects.
C *is* a bit unusual in allowing blatant side-effects in conditions
in 'if' statements. On the other hand, it is not unusual for
procedural languages to allow not-so-blatant side-effects in conditions,
by allowing the conditions to be expressed in in terms that include
a call to a function that has a side effect (perhaps inherent in
the structure of the program logic, perhaps merely some debugging code
that prints out an "I am here" or which dumps out some values.)
I mean you guys rag on Jacob all the time, but you just
so perfectly illustrate his point with this inane over the top
pedantry.
"you guys" is not me. I have never downloaded any of Jacob's software,
and I don't get involved in the conformance witch-hunts. If I happen
to notice him making a mis-statement about C that others haven't
already mentioned, and I have time and can be bothered, then I may
post a correction, just the same as I post questions or corrections
to others (e.g., you.)
It is true that I not infrequently point out that some aspect of Jacob's
postings are off-topic, but that is because his postings frequently -are-
off-topic. I point out topicallity to quite a number of people, if
I haven't noticed someone else indicating the same thing by that time.
I am not a "topicality hound", chiming in days later to say
"Off topic!" when others have already said the same thing.
I mean you don't give a crap at all about the point I was making or
what one I was responding to, but you go over the top with some
ridiculously lengthy response about some irrelevant detail when you
just as easily could have pointed out that casting an expression to
void removes its side effect (issue resolved in less than a
sentence). I accept corrections, not sermons.
If I had indeed "pointed out that casting an expression to void
removes its side effect", then I would have been speaking
incorrectly for expressions that contain side effects, such as
(void)x++
and I would have been speaking redundantly for expressions that contain
no side effects, such as
42
Casting an expression to void would remove any ability to use
the expression as an l-value; but if we were to substitute
the notion of l-valueness in place of side-effectiveness
into your original phrase about what all C statements have, I don't
think that would exactly work out either.
I do give "a crap" about the point you were making about C being
unusual because... unfortunately I haven't yet figured out yet what
the second half of that particular point was attempting to hint at.
But no, I "don't give a crap" about your point about seperating
the side-effect clearly from the condition; it is an element of
style that is important to you, but it is not important to me.
I have no Yeah or Nay to say about it, just as I avoid the
indentation wars and the wars about whether the { opening
a compound statement should go on the end of the line or on the next line
by itself or on the the next line followed by the first statement in
the compound. These matters are not important to the C programming
language. The closest that I can think of to C having anything
to say about them is where it prohibits an #include file from ending
in a backslashed newline, which fact has cramped my style by
an incalcuable amount.
[...] When Paul Heish [...]
Oh, for a second there I thought you were talking about me. I should
probably go on a long rant about how to spell my name properly.
I do apologize for misspelling your name. I usually copy and paste it
to be sure of getting it correct, but that particular time I relied upon
my memory.
And I
still haven't found the word "sentance" in my dictionary, but I'm sure
its there somewhere.
It's in www.urbandictionary.com
So did you have any comments about
source code clarity, useful strategies for warning removal,
intentional operation explicitness, or the value of horizontal code
size? How about just the lcc-win32 compiler?
Like another poster pointed out: none of those are topical for
this newsgroup.