"leon" <le********@yahoo.com> writes:
A good practise is not to use __FILE__ in production code, as compiler
converts __FILE__ into const strings, which takes up static memory.
Of course it's going to take up memory. That's what memory is for.
If you need the value of __FILE__, use it. There's probably no way to
get the same information that's going to consume less memory.
Whether you want to use it in production code depends entirely on how
you want production code to behave. __FILE__ and __LINE__ are
typically used in error messages like "Something bad happened on line
42 of foobar.c". If you don't want your production code producing
messages like that, don't use __FILE__ and __LINE__ (you can use #if
or #ifdef to eliminate the code that uses it) -- but keep in mind that
there's a risk in building production and non-production code
differently.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.