26

I came across the tag today and at first glance had no idea what it should apply to. Then I read the description which in turn made me question whether the tag should be renamed to something more descriptive as it seems the tag name is a bit ambiguous. The current description for is:

The auto keyword was repurposed in C++11 for a deduced type. When used to replace a type name in an initialized variable declaration, the variable is given the same type as the initializer. When used as a return type, the return type is specified as a trailing return type, or deduced from the return-expression.

Looking at the ~1000 questions is being used on, apparently many users also have no idea what it's intended for. is currently being used on everything from Java, JavaScript, and CSS to PHP, WordPress, HTML and Swift. And C++. So, pretty much anything.

Should the tag be renamed to something more descriptive, possibly more C++ centric? What should be done with the hundreds of questions that are currently tagged with that don't have anything to do with C++?

9
  • Well, if you disregard posts where auto is just a filler-word, and generally all off-topic posts, are there still many non-C++ posts left? Oct 10, 2015 at 21:30
  • 1
    Doesn't really look like it Oct 10, 2015 at 21:37
  • @Deduplicator ~33% isn't many?
    – j08691
    Oct 10, 2015 at 21:50
  • 18
    May I be the first to suggest renaming this post Should [auto] be resprayed or scrapped?
    – Pekka
    Oct 10, 2015 at 21:55
  • 5
    @Pekka웃 - Should it be repossessed?
    – j08691
    Oct 10, 2015 at 21:59
  • 5
    @Pekka Probably not [driven out of town]...
    – Zev Spitz
    Oct 12, 2015 at 16:42
  • 1
    @ZevSpitz: That's like a double pun. I'm not sure that's even legal! Oct 12, 2015 at 18:30
  • 1
    @NathanTuggy Sorry; I'm driven and I can't resist...
    – Zev Spitz
    Oct 12, 2015 at 22:02
  • 1
    [auto]: more than meets the eye? Oct 13, 2015 at 3:03

2 Answers 2

15

There are some valid questions involving the auto keyword. I'm not sure burnination is appropriate here. At the same time, I don't love these specific-feature-of-language-X-that-also-exists-by-other-names-in-other-languages tags. I mean, it's OK for one tag to be a subset of another, but in that case, we typically want the smaller tag to involve issues which are specific to the larger tag (e.g. questions in cannot be reformulated to lose their nature without also losing their nature). That's just not true in this case; you can easily reformulate an question into C# or another language with type inference, and the only significant change is renaming auto to var or some other keyword. Unless there's some specific feature of C++'s auto which doesn't exist in any other language?

Detag everything not related to C++, then synonymize it with .

8
  • 2
    The link in your question is 404.
    – j08691
    Oct 11, 2015 at 3:23
  • @j08691: Works for me, but not on the mobile site. Someone go raise a bug on Meta Stack Exchange.
    – Kevin
    Oct 11, 2015 at 3:24
  • I'm on the desktop site.
    – j08691
    Oct 11, 2015 at 3:26
  • 1
    @j08691: ¯\_(ツ)_/¯.
    – Kevin
    Oct 11, 2015 at 3:28
  • 4
    That's an artifact of how broken the new-nav, and especially it's handling for users not using it is. Oct 11, 2015 at 12:25
  • 2
    "Unless there's some specific feature" often it's not about the feature, but about the limitations. Can auto be used as a return type of a recursive function? If you have typedef that is actually a pointer, can you use that to initialise auto or do you need to do auto*? etc. etc. etc.
    – v010dya
    Oct 12, 2015 at 11:16
  • @ZevSpitz: Removed the JS reference.
    – Kevin
    Oct 12, 2015 at 16:39
  • 2
    For those not on the new nav: Here's an equivalent link
    – theB
    Oct 12, 2015 at 16:57
13

There is yet another issue here, and that is that the auto keyword also exists in C, but with a different meaning. It has the same meaning as in legacy C++ code: declare a variable with automatic storage duration.

The auto keyword is rarely ever used in C nor in pre-C++11, yet sometimes it does pop up. I answered a C question regarding this just a few days back. It would have been perfectly on-topic to tag that question , even though it has nothing to do with C++11.

I think the proper tag wiki needs to explain the use of the auto keyword in C and earlier C++ standards, in addition to the C++11 use.


The name can easily be confused with a lot of other things though. Surely there are lots of "automatic things" wherever there is software. Just in C++, I could imagine that several would incorrectly tag questions instead of .

Perhaps it would be best to burn entirely and replace it with .

2
  • If someone uses the auto keyword in a C program, they deserve to be mercilessly harrassed until they remove it, and the tag from their question. I don't think I've ever seen a piece of serious C code that used auto. (Heck, even when types were optional, so auto motive; meant the same as int motive;, the version using auto was longer so serious programmers never typed it). Although your observation about C is valid, it is essentially spurious, but 'tis weird that you got that question with auto in it. Oct 13, 2015 at 0:37
  • 4
    @JonathanLeffler If something, anything, exists in a programming language, then there are always some stupid people who 1) will use it just because they can, and 2) will insist that it is good practice because it compiles.
    – Lundin
    Oct 13, 2015 at 6:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .