Re: Integer Promotions



Philip Potter said:

Richard Heathfield wrote:
Fred said:

<snip>
(void) (u=10); /* set u to 10 */

<snip>

(4. And as usual we discard the value of the assigment expression)

That isn't actually "as usual". Hardly anyone does that, as it's utterly
pointless.

No, I disagree. It's quite sensible to discard the value of the
assignment expression, because the assignment itself was the purpose of
the statement.

Casting the assignment to void, however, is pointless. Luckily, it isn't
necessary to do this in order to discard the value.

Ach! Out-pedanted again! (And you are, of course, perfectly correct.)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: Integer Promotions
    ... This expression is evaluated as an int to yield 10. ... It's quite sensible to discard the value of the assignment expression, because the assignment itself was the purpose of the statement. ... Casting the assignment to void, however, is pointless. ...
    (comp.lang.c)
  • Re: Layer 2 arp snooping without Layer 3?
    ... it will be pointless. ... and the kernel will most likely discard ... not have to be on the link you're sending your ARP cahce poisoning. ...
    (Pen-Test)
  • Re: Did you know?
    ... But programmers don't hesitate to discard that ... >> baggage when it suits them. ... Pascal, OTOH, is free of such confusion and uses:= for assignment. ...
    (comp.lang.c)
  • Re: Incrementing in C
    ... Calling `foo` doesn't change that. ... Because the assignment of `y` to `x` is pointless; ... Chris "echo echo" Dollin ...
    (comp.lang.c)
  • Re: free()
    ... This being a place where the assignment of NULL is completely ... ...but then it's a pointless function anyway. ... It frees the store its argument points to and names what's ... A rock is not a fact. ...
    (comp.lang.c)