Questions tagged [assignment]

For questions about assignment, the act of assigning a value to a variable or data structure.

Filter by
Sorted by
Tagged with
24 votes
3 answers
6k views

Why are volatile objects so difficult to work with in C++?

C++ does not generate default copy/move constructors or assignment operators for any volatile struct or ...
Bbrk24's user avatar
  • 8,857
17 votes
9 answers
4k views

Why add an increment/decrement operator when compound assignments exist?

Many languages have compound assignment statements, for example +=. However, for the common task of adding or subtracting 1 from a variable some languages (mostly ...
Seggan's user avatar
  • 2,603
2 votes
1 answer
137 views

What are the pros and cons of having assignment expressions? [duplicate]

Some languages (for example C and C++) have assignment expressions, which means the assignment statement as a whole returns a value of the object specified by the left operand after the assignment. So ...
justANewbie's user avatar
8 votes
4 answers
368 views

What are the potential problems with assignment operators returning the new-value operand and how can they be avoided or mitigated?

Inline assignment is when the assignment operator can return the value of the new-value (right-hand) operand. For example: ...
user16217248's user avatar
  • 7,535