Jump to content
  • Advertisement
Sign in to follow this  
Nanook

first chapter

This topic is 4357 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I just started on my c++ book (accelerated c++), I've read the first chapter.. but I didnt get what they ment by side effects of an expression.. does anyone mind explaining this for me? Nanook

Share this post


Link to post
Share on other sites
Advertisement
nope.. hmm I can write what it says in the book:

"An expression asks the implementation to compute somthing. The computation yields a result, and may also have side effects--that is, it may affect the state of the program or the implementation in ways that are not directly part of the result. For example, 3+4 is an expression that yields 7 as its result , and has no side effect, and

std:cout << "Hello World!" << std::endl

is an expression that, as its side effect, writes hello, world! on the standard output stream and ends the current line."


Might be me thats tired? I kind of get it, but I dont.. hehe is it possible to explain this easy?

Share this post


Link to post
Share on other sites
Some expressions are evaluated for their results. Some expressions have side effects. In a = b + c, assuming a, b and c are primitives like ints, then the expression b + c has no side effects; all that happens is the value of b + c is evaluated. However, the expression a = b + c has a side effect, an action that occurs in addition to the value of the expression: it assigns the value of b + c to a.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!