News for hackers. Stuff that matters.
Re:A bug in GCC that may cause memory leaks in valid C++ pro... by ars on Thursday April 27, 2017 @07:29PM (#14215723)
> I would like to point out that if you write code like this (that is, creating a temporary object only to have it instantly deleted), your code smells.

Not necessarily. What if all you want are the side effects of the object?

In particular I/O. Either disk or network.

Creating the object opens the connection, destroying it closes the connection. And you use the object in between to write data.

Or, don't assign the new object to anything, and simply write the data you pass in to it, and close the stream.

It's a perfectly reasonable use case.

Re:A bug in GCC that may cause memory leaks in valid C++ pro... by wfunction on Thursday April 27, 2017 @07:35PM (#14215760)
> And you use the object in between to write data

That's not what I was talking about. See the original comment and follow-ups.

Re:A bug in GCC that may cause memory leaks in valid C++ pro... by ars on Thursday April 27, 2017 @07:40PM (#14215780)
> That's not what I was talking about.

You didn't read my next sentence.

I was explaining that you could use the object in two ways. (If you only ever used it the second way then you would just make it static, so I was giving the first way as a reason why it would not be static.)