I usually use the latest version of C++ that my compiler supports. The latest version is C++20 which was released in December of 2020.
You can use older versions as well, but there's usually no real reason to use an older standard, and some of the features you may want to use might require a specific version. For example, if you look at the documentation for std::optional, you'll see
(since C++17), which means you'll have to use at least -std=c++17 or -std=gnu++17.
Of course, your compiler has to be modern enough to be able to use the latest standards. For example, the Arduino AVR core comes with GCC 7.3.0 which fully supports C++14 and pretty much all of C++17. You can check compiler support in this table: C++ compiler support - cppreference.com
Whether you use -std=c++xx or -std=gnu++xx depends on your preferences and whether you need portability. If you use -std=c++xx, GCC will adhere more closely to the official C++ standard. If you use -std=gnu++xx, it allows you to use GCC-specific extensions to the language, which won't work on other compilers like Clang or MSVC.
You usually don't need these extensions, so unless you have really specific needs, I'd turn them off by default.
That link is to the latest development version. It goes all the way up to C++23 (which is the version that's currently under development).
If you want the documentation for a specific compiler version, go to https://gcc.gnu.org/onlinedocs.
Hello,
I tested CODE::BLOCKS as an alternative to Visual Studio. If you are using Windows, consider Visual Studio Express as a viable alternative. The debugging functions of Visual Studio are much better. (but tastes and opinions can differ)
Best Regards,
Johi.