Paul,
Thanks for your help. Please see my comments embedded below.

--- In [email protected], "Paul Herring" <[EMAIL PROTECTED]> 
wrote:
>
> On 5/30/07, chipaug <[EMAIL PROTECTED]> wrote:
> >
> > In Chapter 0 of "Accelerated C++" the authors speak of results 
and side
> > effects. I'm having some difficulty in distinguishing between 
them.
> 
> 
> int i, j=5;
> 
> i = printf("%d", j++);
> 
> Result: i  = 1 (number of characters printed)
> Side effect: j = 6 (i.e. it's incremented)

Thanks. I was confused. I thought there would be two results, i = 1 
and j = 6, and the character printed was the side effect.

> 
> Also, on page 6 in Chapter 0, under the heading of "Braces and
> > semicolons," there is this sentence. "The expression is optional;
> > omitting its results in a null statement, which has no effect." I 
do
> > not understand this sentence.
> 
> 
> Need more context - what expression? A null statement is something 
that
"An expression followed by a semicolon is also a statement, which is 
a request to execute the expression for its side effects and discard 
the result. The expression is..."

> doesn't do anything; a lone semicolon or an empty set of braces are 
both
> null statements:
> 
> for(int i=0; i<10; i++){
> }
> 
> for(int i=0; i<10; i++)
>    ;
> 
> Are equivilant.
> 
> 
> -- 
> PJH
> "I contend that we are both atheists. I just believe in one fewer 
god than
> you do. When you understand why you dismiss all the other possible 
gods, you
> will understand why I dismiss yours."
> -- Stephen Roberts
> 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to