This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Annoying pre-processor fluke.


    I'm running egcs1.1 on HPUx and my debug preprocessor code that I've
run on other compilers (can't guarantee it was egcs though) is suddenly
breaking my build. The code looks something like the following:

-- file DEBUG.HPP
#ifdef DEBUG_ON
    #define PDBUG {cout << __FILE__ << " : " << __LINE__ << " ";} cout
#else
    #define PDBUG /##/ Junk
#endif

-- file CODE.CPP

PDBUG << "This is a debug message." << endl;

    Now if DEBUG_ON is defined my code works as expected.  However, if
it's not then my code breaks returning an error message saying "parse
error before `/'". Now when I run g++ with the -E command to output all
my preprocessor stuff my code line looks just fine coming out as:

// Junk << "This is a debug message." << endl;

    Obviously something is not getting the preprocessor output right but
I don't know what it is and can't seem to fix it in any event. Because
of the way I write my debug messages defining PDBUG( param ) isn't a
happy workaround although it would avoid the need to redefine it into a
comment. Anyone know what's up with this?

    thanx & later,

        Ben Scherrey

PS: Please fwd any response to scherrey@switchco.com.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]