Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#define FNAME

Status
Not open for further replies.

ralphtan

Technical User
Oct 15, 2002
15
SG
Hi,
recently I encounter some of my ex-colleagues codes that use this:

my question is what is the usage of #define FNAME "ABC" in this case?

Thanks.

/********/

#define FNAME "ABC"

void ABC(int a, float b){
...
}

#undef FNAME
/*********/
 
#define FNAME "ABC"

is a constant character string.

Not related to function ABC ();

maybe used in the bowels of ABC ();

tomcruz.net
 
hi ralphtan,

In the code you have given, #define plays no role as it is not used anywhere.

Thanks,
Sanjay
 
It is probably used in tracing. The TRACE macro may be defined as something like
Code:
#define TRACE(x) fprintf(stderr,"%s: %s=%d\n", FNAME, #x, x)
It is possible that all the TRACE statements in the code have been removed. However, when it was being developed they might have stuck
Code:
TRACE(fred);
into the code. Since fred was probably defined all over the place, knowing which routine it came from would have helped in debugging. I wouldn't remove them because if you want to use the TRACE macro in the future, you will have to stick them back in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top