Search code examples
visual-c++visual-studio-2005verbosity

Tips for writing the least verbose Visual C++ code you can in Visual Studio 2005?


While I realize that Visual C++ is a language lacking much of the syntactic-sugar that most of us new programmers are used to these days, VC++ 2005 must have some shortcuts that can decrease the verbosity of the code at least a little; does anyone know of these, or is c++ just that verbose?


Solution

  • VC++ offers a couple of extensions that are not part of C++ standard, the only one that comes to my mind right now is "for each" but I can't see why somebody would use it since boost offers a portable implementation.

    std::vector<int> vec;
    for each(int i in vec)
    {
        // do something with i
    }
    

    The only other advice is to use standard library and boost as much as possible and not reinvent the things somebody else had already implemented (probably much better than you could).