forked from hellogcc/100-gcc-tips
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f5a20
commit 135a78f
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 指定语言类型 | ||
|
||
## 技巧 | ||
|
||
gcc是通过文件名后缀来判断源代码语言类型的。 | ||
|
||
如果你从标准输入把源码传给gcc,那么就需要通过`-x`选项显式的指定语言类型: | ||
|
||
$ echo "int x;" | gcc -S -x c - | ||
$ cat ./-.s | ||
.file "" | ||
.comm x,4,4 | ||
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3" | ||
.section .note.GNU-stack,"",@progbits | ||
|
||
详情参见[gcc手册](https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html#Overall-Options) | ||
|
||
## 贡献者 | ||
|
||
xmj | ||
|