j0mbolar said:
does the standard guarantee that the type of an expression
is implicitly void as it does for functions?
for example:
int i = 0xff;
i;
does the type implicitly have void
since it isn't used for anything.
Expressions have a type and a value.
In the statement:
i;
the type is "int" and its value is 0xFF. There does not have
to be any conversion to "void".
The compiler is free to optimize expressions and statements.
The expression above does not change any variables or memory
locations, so a good compiler will remove it from the code.
In the statement:
i = i + 5;
it still has type "int", but the value will be the result
of "i". The compiler does not convert its type, nor does
it need to. The compiler usually does not remove this
kind of statement.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq:
http://www.parashift.com/c++-faq-lite
C Faq:
http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book