« first day (1538 days earlier)      last day (1306 days later) » 

7:09 AM
@NotAZoomedImage Why not just use Person p; or Person p{}; instead of Person& p = Person();? Why do you want the reference?
Note that Person p(); won't work, that would be a function declaration.
 
 
2 hours later…
8:51 AM
:50549253 In my understanding (that maybe wrong), the following are equivalent.


Person p;

Person p = Person();

Person p{};

Person p();

Please correct me if I am wrong.
 
 
2 hours later…
10:44 AM
@NotAZoomedImage For practical use: the first three lines are equivalent and they initialize the object p while the fourth line is a function declaration.
Right after we extend the lifetime of a temporary object, is that object still considered as temporary or not ?
 
11:25 AM
@domocar1 I see. You are correct. The fourth is not possible for declaring a variable. The second one is called as Copy Initialization and the remaining two are called as Direct Initialization. I just read it. Thank you all!
 
 
8 hours later…
7:18 PM
Good day folks!


When we forget to delete an allocated heap memory in C++ with `delete[]` or `delete`, why cannot the allocated heap memory be freed by the operating system itself? I am so curious with this phenomena. Could you tell me why?
Or why cannot other applications use the allocated heap memory? What prevents it from being used by other applications?
If you respond this question, please ping me. Thank you in advance. It is impossible to monitor this chat room 24/7.
 
 
2 hours later…
9:24 PM
@NotAZoomedImage the Operating System does clean it up, when it stops the process.

Otherwise the Operating System has no idea when you're done with the memory, it doesn't know when it would be fine to delete it.

Other processes can't use that memory because it's still reserved by your programs process.
 
 
1 hour later…
10:53 PM
@PeterT: Thank you very much! Very good info about the process. :-)
 

« first day (1538 days earlier)      last day (1306 days later) »