strange preprocessor stuff
Carl Ollivier-Gooch
cfog at mech.ubc.ca
Tue Apr 20 18:59:41 CDT 2010
Jason Kraftcheck wrote:
> iBase.h, iMesh.h, and iGeom.h all appear to contain the following
> preprocessor statements:
>
> #ifndef ITAPS
> #define ITAPS
> #endif
>
> This is a really generic name for a preprocessor variable. It will have the
> side effect of stripping all instances of the token 'ITAPS' from any code
> that includes our headers. One particularly case encountered by someone at
> UWisc was as follows:
> The directory in which to search for a test file is specified to the
> test code at compile time with a preprocessor macro: -DSRCDIR=...
> The code does something like:
> const char* input_file = STRINGIFY(SRCDIR) "/input.vtk";
>
> If the user has the source installed in a location such that one of the
> components of the path is 'ITAPS' (or in this case 'ITAPS-src'), then the
> preprocessor will remove the 'ITAPS' string from the path, causing the test
> to fail because it cannot load the input file.
>
> I cannot find anywhere where this preprocessor macro is used. Does anyone
> know why we have this in the headers? Can it be removed? Or if not, can it
> be renamed to something like '_ITAPS_INTERFACE'?
The reason for having -something- like this -somewhere- is so that an
implementation can choose to compile things differently when it's not
using ITAPS. Since my implementation does this, it's entirely possible
that I started the whole thing. Changing the name to something sensible
would be a good idea, though. Maybe _ITAPS_iBase, _ITAPS_iMesh, etc?
Carl
--
------------------------------------------------------------------------
Dr. Carl Ollivier-Gooch, P.Eng. Voice: +1-604-822-1854
Associate Professor Fax: +1-604-822-2403
Department of Mechanical Engineering email: cfog at mech.ubc.ca
University of British Columbia http://www.mech.ubc.ca/~cfog
Vancouver, BC V6T 1Z4 http://tetra.mech.ubc.ca/ANSLab/
------------------------------------------------------------------------
More information about the tstt-interface
mailing list