我想知道vc里文件里用了debug宏之后当发生内存泄露的时候他能定位是哪一行出现了错误,我想知道如何定位的,以前看debug宏的时候注意过vc里好象有一个宏直接就是代表当前代码行的(这个宏是怎么写的?),现在我在网吧没任何工具,谁能给个方法?thx

解决方案 »

  1.   

    __LINE__ The line number in the current source file. The line number is a decimal integer constant. It can be altered with a #line directive.  The #line Directive
    The #line directive tells the preprocessor to change the compiler’s internally stored line number and filename to a given line number and filename. The compiler uses the line number and filename to refer to errors that it finds during compilation. The line number usually refers to the current input line, and the filename refers to the current input file. The line number is incremented after each line is processed.Syntax#linedigit-sequence "filename"optThe digit-sequence value can be any integer constant. Macro replacement can be performed on the preprocessing tokens, but the result must evaluate to the correct syntax. The filename can be any combination of characters and must be enclosed in double quotation s (" "). If filename is omitted, the previous filename remains unchanged.You can alter the source line number and filename by writing a #line directive. The translator uses the line number and filename to determine the values of the predefined macros __FILE__ and __LINE__. You can use these macros to insert self-descriptive error messages into the program text. 
      

  2.   

    这个是vc里有的,我想知道他怎么实现的,我实际上是想在标准c中实现__LINE__