C++ syntax highlighting does not work when c++03, c++14, c++17 or c++20 are used, unless c++ is added as well. However, it does work with c++11 alone so I know it is possible, and makes me think the former was not intended behaviour. I'd like to see this extended to all the variants.
2 Answers
Braiam is right: the solution here is to tag all questions with the c++ tag, and then you'll automatically get syntax highlighting appropriate for the C++ tag.
This is just another special case of the more general rule that, when you use a version-specific tag, you should also always tag with the "main" tag.
For example, when you tag with c++11, you also tag with c++. When you tag with c#-6.0, you also tag with c#. When you tag with sql-server-2017, you also tag with sql-server. Et cetera.
Nicol Bolas already gives the real reason for this:
[T]he question needs the attention of C++ experts, since it's a question about C++. So it should have the C++ tag.
The tag system is designed to help experts find questions. It is a classificatory system. A large number of our expert answerers filter based on tag, and they don't always include version-specific tags in their filters, so they may easily miss your question if you don't use the primary tag.
We (moderators) could add syntax highlighting hints to the version-specific tags, but it is not necessary because of the ground rules for version-specific tags. Think of the lack of syntax highlighting as an incentive to tag the question correctly.
-
5Oh, I did not know that was a rule. Actually I believed the opposite was what was expected. Good to know (and have in writing) and sorry!– The VeeCommented Feb 20, 2019 at 18:30
-
4No need to apologize. Apparently this guideline is not nearly as well-known as I thought.– Cody Gray ModCommented Feb 20, 2019 at 18:31
-
1Often enough I find a question running out of tag space and have to decide which of a worthy one needs to go to make room for another slightly better one. This compounds that, unfortunately. Commented Feb 22, 2019 at 1:10
-
1I think that's only ever happened to me a handful of times in ~9 years, @Dave. A lot of people overuse tags. They're supposed to describe the content of the question itself, not just the context or the broader ecosystem. If your question isn't about the IDE itself, you don't tag with [visual-studio], for example. If it's not about features of the Windows OS, you don't tag with [windows]. That narrows the list down pretty quickly.– Cody Gray ModCommented Feb 22, 2019 at 1:47
-
1Including a supertag when subtagging also means that 5 tags might not be enough Commented Feb 22, 2019 at 4:20
-
@CodyGray I notice it on questions which crossover the usual 'boundaries'. I look at a lot of VB6 / COM interop / C# questions which tend to need more tags than normal. Also, it is obviously hard to know which specific tags have the most "experts" following them though some might be obvious. Personally I follow the esoteric as well as broader tags because of that. Assuming people will tag well seems like a bad guess. Commented Feb 22, 2019 at 12:29
The tag usage is supposedly: use c++ always, then add specific standard tags if needed. People watch the main C++ tag but not necessarily the rest of them. So by just using c++11, the C++11 experts might not even read your post.
I would think this to be more important to the person asking the question than code formatting.
<!-- language: lang-cpp -->
while using 4 space formattings