linuxeasy

strange c++ syntax

Sep 5th, 2011
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. Please explain the following expression which is of c++
  2. I have a statement:
  3. which is just:
  4.  
  5. a + b + c + d ;
  6.  
  7. where "a", "b", "c" and "d" could be any type like int or double or string or any expression of your choice!
  8.  
  9. for extra understanding, you often you come across syntax such as:
  10.  
  11. a = b + c ;
  12.  
  13. where "a" stores a value which is a result of addition of "b" & "c", so its like assignment operation. But the above statement in question does not even seem to assign anything.
  14.  
  15. So the questions for you is:
  16.  
  17. 1. is the above statement simply meaningless?
  18.  
  19. 2. Since its making Addition but not actually Assigning it to anything?
  20.  
  21. 3. so its not really having any side-effect such that, its existence and non-existence cannot have any change on the system system?
  22.  
  23. 4. or can such statement can really bring any changes to the system (or application or program whatever word you say )?
  24.  
  25. For more clarity, please take note that this statement could appear anywhere in the program, for example, this statement can validly appear inside a function, which may or may not be a member of a class. a, b, c, d could be just any valid types (primitive types) or object of c++.
  26.  
  27. thats all
Advertisement
Add Comment
Please, Sign In to add comment