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.
gcc -Wall
is a classic.-
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.)