What's the meaning of #line in C language?

前端 未结 6 1714
借酒劲吻你
借酒劲吻你 2021-02-01 03:27

What\'s the meaning of #line in the C language? Where would it be used?

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 04:15

    It is called the preprocessor line control directive.

    The expansions of both __FILE__ and __LINE__ are altered if a #line directive is used. It causes the compiler to view the line number of the next source line as the specified number.

    Its main use is to make the compiler provide more meaningful error messages.

    You can find more explanation and a usage example in IBM's documentation.

提交回复
热议问题