16

I still attend JSA (javascript anonymous) meetings...

Comments
  • 7
    So the web frontend stuff is for babies but C++ is for already grown-up kids, interesting!
  • 3
    Those quotation marks are revolting.
  • 3
    @donkulator I am thinking kids shouldn't be exposed to "std".
  • 4
    @donkulator when you use MS Word as your IDE…
  • 2
    @donkulator

    Global using namespace are evil.

    (And defeat the whole point of namespaces)
  • 1
    @Demolishun

    But surely they can have a std:: future?
  • 0
    @CoreFusionX that is so fucked up.
  • 0
    @CoreFusionX

    "Global using namespace are evil."

    But but that is how my teacher did it...
  • 2
    @Demolishun my teacher also wrote doc comments for each and every trivial getter and setter in Java.

    /*
    Gets the horse shit.
    - params: none
    - returns: horse shit
    */
    HorseShit getHorseShit() {
    return this.horseShit;
    }
  • 1
    @CoreFusionX
    > Global using namespace are evil.
    > (And defeat the whole point of namespaces)

    Not if they are file global.
    Ok, there is no file level in C++ but if I use it in a cpp file (not a header),

    using my_namespace;

    then it will only apply to that file, IIRC.
    And IMO this is ok.

    Btw, can you disambiguate possible collisions by fully qualifying the name with its namespace on the spot?
    If yes, that makes it even more viable. (Assuming that the compiler treats this as an error and not just picks one of the multiple possible names silently)

    In C# and Swift you can do that np.
  • 2
    @Lensflare

    You can indeed disambiguate by fully qualifying, yeah.

    Using using in an implementation file is not so bad, but doing so in a header file deserves the gallows, because you'll pollute the global namespace of whichever file includes it.
  • 0
  • 0
    @Lensflare I am not defending it. Just repeating the lame excuse for a lot of programming anti patterns.
  • 1
    @CoreFusionX I don't like it in a file scope. It can dump so many symbols into the space. I don't mind so much in function scope.
  • 1
    @Demolishun I didn’t even know that it's possible to do it function scope in C++! Sounds great!

    Definitely not possible in C# and Swift!
  • 2
    @Lensflare

    You can just create a scope on the fly:

    using namespace std{

    }

    Sometimes I just do this:

    void stuff()

    {

    ...

    {

    //some var I want deleted outside braces

    int something;

    }

    ...

    }
Add Comment