6

Background: I recently came across a question on Stack Overflow where the asker had a comment-reply to another user about how they didn't know how to google for compiler arguments that start with a dash (the tricky thing is that with google, starting a word/search-term with a dash uses the dash as an exclusion operator!). It reminded me how when I was starting out with C++, that was a problem that bit me for a long time before I somehow learned what was going on (the exclusion operator). I can't even remember how I learned what was going on. Remembering those experiences made me think that there could be value in asking and answering such a question about it somewhere on the Stack Exchange network, but I'm not sure where it might be a good fit to ask. This question isn't limited to compiler arguments that start with a dash. It applies for any kind of command-line flag that starts with a dash.

Since part of the question is about command-line arguments, I thought it could make sense to ask on superuser.com, but I haven't used superuser.com before, and am not sure if such a question belongs there.

I thought of whether it could make sense to ask on Stack Overflow, but that was when I was still thinking only about compiler arguments and hadn't realized the question could be generalized to any command-line arguments.

I'm aware that this question could be generalized even further by abstracting out the contextual detail about command-line arguments entirely and then asking this question on webapps.stackexchange.com, where a related (similar but different) question already exists. But I feel conflicted because I can speak from experience that such a non-generalized question about command-line arguments specifically would have helped me and probably at least one other Stack Exchange user who was on SO.

Here is my draft of the question and answer:

Question Draft

Title: Why don't I find any expected results when google searching for command-line arguments that start with dashes?

When I try to google search something like "gcc -Wall" (for example,) to find documentation on the -Wall flag's meaning for GCC, it looks like I get the same search results as if I just searched "gcc": None of the results seem to include the text "-Wall" in them.

Why doesn't the search query with search terms starting with dashes seem to work as I intend, and how can I properly query for terms like command-line arguments that start with a dash?

Tags: TBD

Answer Draft

gcc -Wall actually tells the Google search engine to include things that match "gcc", and exclude things that match "Wall". This is because "-" is one of several special characters called "search operators" for the Google search engine.

If you go to "How to search on Google", it links to a page about search operators that documents the various search operators and how they work. For this particular one, if you start a term with a dash, it will tell the Google search engine to exclude that term from the search.

To properly search for pages related to "-Wall", use the "exact match" operator: enclose/wrap the term that starts with dashes with double quotes, like "gcc "-Wall"".


Is such a question useful and a good fit for Stack Exchange in its current form where it asks specifically about command-line arguments? If so, is there a Stack Exchange site that it fits on? Does it fit on Super User? Would it be more valuable to the community at large if I abstracted out the detail about command-line arguments and asked on webapps.stackexchange.com?

Note: If such a question exists, maybe a duplicate signpost is in order, because I couldn't find it/them by googling the title of the question I drafted.

Update: This question has now been asked here on webapps.stackexchange.com.

4
  • Yes, gcc -Wall is a classic. Dec 30, 2022 at 5:18
  • @This_is_NOT_a_forum was that light sarcasm? I sincerely cannot tell.
    – starball
    Dec 30, 2022 at 5:20
  • 1
    No, it wasn't. At all. I avoid sarcasm as much as possible. I ran into the - search issue while mapping out various GCC options. It is much less trivial than one would think (spread out over about 20 (canonical) pages (but you have to find them first), some left out on the man page, some are deprecated/removed in later GCC versions, etc.) Dec 30, 2022 at 5:34
  • cont' - I found an index, but only very late in the process (and it isn't without flaws). Dec 30, 2022 at 5:38

1 Answer 1

8

If it’s a question about 'How to google this?", Web Applications. In this case that it’s a command-line argument is a bit of context, and the real question is googling inclusive of a dash. I personally wouldn't worry too much about potential duplicates if a cursory google, and the automatic question suggestion thing when you ask a question don't suggest it’s been asked before.

If it’s a question about gcc -Wall itself, Super User or Unix & Linux would be a better fit.

3
  • To clarify, are you suggesting that if I ask on webapps.se.com, I should completely abstract away the fact of the question's applicability to googling for command-line arguments?
    – starball
    Dec 30, 2022 at 5:38
  • And would it be widely considered as bad etiquette (being rep-greedy) to ask the generic (no mention of command-line args) question on webapps.se.com, and also ask the command-line-args-specific question on superuser.com?
    – starball
    Dec 30, 2022 at 5:41
  • 2
    Its a question about how to google command line args with a '-', and how to google about things with a -. Its not about finding command line arguement, its about searching for it. Dec 30, 2022 at 6:07

You must log in to answer this question.

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