Sunday, April 6, 2008

How To Tie A 2 Rings Belt

Retrieving information from source code PyRenamer

In the development stage of a program, usually we write debugging lines (yeah... debugging tools such as gdb
[1] or
valgrind
[2] would be a more valuable option). But, when we work with very large programs, would be very useful knowing the file and line os source code where such debugging line is placed. This task can be achieve with the
preprocessor directives
[3]:
  • __FILE__
__LINE__
    Example of use:
fprintf( stderr, "%s : %s\n", __FILE__, __LINE__, "some text"); [1] http://sourceware.org/gdb/
[2] http://valgrind.org/
    [3] http://www.cplusplus.com/doc/tutorial/preprocessor.html

0 comments:

Post a Comment