Background: 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 a search query with search terms starting with dashes seem to work as I intend (return results containing matches of the terms that starts with a dash), and how can I properly query for terms that start with a dash?

Note: Related, but not a duplicate (because it is more general, and the answer is binary-different as a result): How do I escape Google functional characters?.

  • 1
    Meta note: It was discussed where and at what level of abstraction away from command-line arguments / compiler flags to ask this question here on meta.stackexchange.com
    – starball
    Commented Dec 30, 2022 at 6:33

1 Answer 1


gcc -Wall actually tells the Google search engine to include things that match "gcc", and exclude things that match "Wall". This is because the dash/hyphen character, "-", 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/hyphen, it will tell the Google search engine to exclude that term from the search. Quoting from the current user documentation:

Exclude words from your search
Put - in front of a word you want to leave out. For example, jaguar speed -car

To properly search for pages with matches of search terms that start with a dash/hyphen, use the "exact match" operator: enclose/wrap the term that starts with dashes with double quotes (including the dash/hyphen), like "gcc "-Wall"".

The "exact match" operator does what its name suggests: It is used to search for exact matches, and can be used to treat the dash/hyphen as part of the search term for which to find an exact match. Quoting from the current user documentation:

Search for an exact match
Put a word or phrase inside quotes. For example, "tallest building".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.