"Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearCP
C & C++ 3y ago
Jump
What is the difference between ++i and i++?
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearFR
    freely
    3y ago 100%

    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.

    1
  • github.com

    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

    1
    0
    "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearCP
    C & C++ 3y ago
    Jump
    What is the purpose of 'using namespace std' in C++?
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearFR
    freely
    3y ago 0%

    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;).

    0
  • github.com

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

    1
    0