Constructors copying other objects

Pages: 12
1. Anytime you declare a named object it gets its own stack space. Although your compiler might pull some optimizations on you, such that the temporary object is never even constructed, and p1 is constructed just using the arguments (0,0).
(I'm not sure if the standard allows this, but I know compiler writers are given some leeway during construction)

2. The two main reasons you can't have a non-const reference to a temp object are:
a) It doesn't make sense.
b) It can cause hard to trace bugs (When do lifetimes end and such)

3. See 1.
Thanks everyone!
Topic archived. No new replies allowed.
Pages: 12