freely

joined 3 years ago
[โ€“] [email protected] 1 points 3 years ago

Yeah the value copy is necessary to return the old (pre-increment) value with i++. However, your compiler is (usually) smart enough to optimize the copy away if you never use it.

That being said, being explicit is good, so use ++i if you don't need the old value. Don't depend on the compiler to maybe do something.

 

It's not perfect, but I'm excited I might one day get to swap to Podman for better security. Probably wait till this closes for serious use though https://github.com/portainer/portainer/issues/5188

[โ€“] [email protected] 0 points 3 years ago* (last edited 3 years ago) (1 children)

Most things in the various STD libs are namespaced as to not clash with other programs. using namespace imports everything in a namespace into your current namespace, even for things you didn't include.

It's just a shortcut to write less, and is a bad habit taught to beginners. It can cause name collisions for all sorts of things since it imports all of std, not just the headers you include.

Just don't use it. If you insist, scope your use of using by putting it inside of functions/methods, and specify specific things to import (i.e. using std::string;).

 

Any news on what this brings? I have no idea where to find the changelog lol