Is it possible to print macro's with gcc during compile time?
something like
And that gcc says 4 then during compilationCode:#define MACRO 4 #pragma warning MACRO
Is it possible to print macro's with gcc during compile time?
something like
And that gcc says 4 then during compilationCode:#define MACRO 4 #pragma warning MACRO
What does the manual page tell you?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
a lot, but not what im looking for
nobody knows?
Since you're looking for compiler-specific behaviour anyway, just try it out.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
jah, of course I tried it but it doesnt work. The original problem why I wanted to do this is solved but I'd still like to know how this is possible, could be handy next time.
gcc docs say lots of things about pragma's, but nothing about printing macro's
What does it print?
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
You can add macro's during compiling using this:
This is the same as:Code:gcc source.c -DMACRO=4
It's not the solution to your question, but you can "view" your macro's during the compiling.Code:#define MACRO 4
Operating Systems:
- Ubuntu 9.04
- XP
Compiler: gcc
You can use a sort of if-else construct.
But I'm sure you've already thought of that.Code:#define DEBUG 1 #if DEBUG == 1 #pragma warning Debug mode on. #elif DEBUG == 0 #pragma warning Release mode on. #else #pragma warning Invalid DEBUG macro. #endif
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
all I get is
c:\bla.c(245): warning: ignoring #pragma warning xxx