以井号和数字开头的行是什么意思,如“#1“a.c""在 gcc 预处理器输出中? [英] What is the meaning of lines starting with a hash sign and number like '# 1 "a.c"' in the gcc preprocessor output?

查看:15
本文介绍了以井号和数字开头的行是什么意思,如“#1“a.c""在 gcc 预处理器输出中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用打印出 C 预处理器的输出

I print out the output of C preprocessor by using

gcc -E a.c

输出包含许多行,如

# 1 "a.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.c"
# 1 "c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/stdio.h" 1 3
# 19 "c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/stdio.h" 3
# 1 "c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/_mingw.h" 1 3
# 31 "c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/_mingw.h" 3
       
# 32 "c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/_mingw.h" 3
# 20 "c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/stdio.h" 2 3

我从未在 C 中见过这种语法.有人能解释一下这是做什么的吗?

I've never seen this kind of syntax in C. Can someone explain what this is doing?

推荐答案

这些行是调试的提示(该行后面的代码实际上来自哪里)

These lines are hints for debugging (where the code following the line actually came from)

# line-number "source-file" [flags]

标志的含义(空格分隔):

Meaning of flags (space separated):

  • 1 - 开始一个新文件
  • 2 - 返回上一个文件
  • 3 - 以下文本来自系统头文件(#include <> vs #include "")
  • 4 - 以下文本应被视为包含在隐式 extern "C" 块中.

这篇关于以井号和数字开头的行是什么意思,如“#1“a.c""在 gcc 预处理器输出中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆