I know that using
gcc -dM -E - < /dev/null
can get the predifined macros of gcc
, but what does the
- < /dev/null
mean in this command? Per my understanding, there should be a option behind -
. I have tried to search on gcc manual, but can't find answers.
On its own, -
means "read from standard input instead of the filename that would otherwise be provided on this command-line". This is a common Unix convention.
The < /dev/null
redirects standard input from /dev/null
, which is of length 0. Thus GCC will read from standard input and immediately reach the end of the input, causing it to print only the predefined macros (and not any macros in input, because there isn't any input). This is standard shell syntax, not specific to invocation of GCC.
Together, they are a way to provide no input to a process that expects some.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With