简体   繁体   中英

What does “- < /dev/null” mean in “gcc -dM -E - < /dev/null”?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM