Topic: Need Help with a Preprocessor Problem
Author: Ron Natalie <ron@sensor.com>
Date: Fri, 19 Oct 2001 15:19:26 GMT Raw View
vasuarv wrote:
> I am working on writting a macro
>
Your out of luck in C++. In C (as of 1999) there is a Pragma
preprocessor operator, which makes things much easier to
conditionally control pragmas. Oddly the pragma operators
origins are very old (implementatinos that made heavy use
of pragmas had it back in the late eighties), it's a shame
it didn't make it into the C++ standard.
For example, early on in the file you can do something
like:
#ifdef __acmecomputer
# define ACME_PRAGMA(x) Pragma(x)
#else
# define ACME_PRAGMA(x)
#endif
then later in your code you can do something like:
ACME_PRAGMA("unroll loop")
for(int i = 0; i < n; ++i) { //...
and on the Acme computer it substitutes the pragma and
on other computers it substitutes nothing.
You can see if your C++ compiler supports it as an extension
(which it might if they are tracking C99 changes).
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]