[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Problem with preprocessor symbols (gcc-2.96-69)

Trying to use the following to make my code cleaner to read:

#define COMMENT /SLASH(/)
#define SLASH (##s)

#ifdef DEBUG
#include <iostream>
#define dout std::cout
#define dout COMMENT

I get the error:

token may not appear in macro parameter list

I want the line to appear if DEBUG is defined:

	dout << "Debug message" << endl;

Example (DEBUG is defined), line appears as:

	std::cout << "Debug message" << endl;

If not then it appears as:

	// << "Debug message" << endl;

The whole purpose of this is to ensure that the code is easy to read. At
present there are a lot of debugging statements that don't need to be done
for the release version (whenever that will be). The present method uses a
lot of #ifdef DEBUG and #endif statments to ensure that this is done. So I
am trying to use this easier to read method.


s torri lancaster ac uk

Buyer's Guide for a Operating System:
Don't care to know: Mac
Don't mind knowing but not too much: Windows
Hit me! I can take it!: Linux

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]