www.digitalmars.com         C & C++   DMDScript  

c++ - language extension __debug statement

reply Richard <fractal clark.net> writes:
Having some trouble with the __debug extension to c++ in a console-debug
project.

When I try:

#include <iostream>
void main(int argc, char *argv[])
{
__debug int HD = 1;
__debug(HD)cout << "working" << endl;
}

There is no output. Perhaps I have misunderstood the syntax.. I thought that
"__debug (expression) statement else statement" was a conditional control ala
"(expression) ? statement : statement". Did I get it wrong?

mmmm..

I also try just:

#include <iostream>
void main(int argc, char *argv[])
{
__debug cout << "working" << endl;
}

and no output. Has the __debug extension to c++ been deprecated in DM? Perhaps I
need throw some compiler switch?

Ok, I know its an extension. I have one core module that has copious output when
debug, and it is useful to turn it on and off at times while in a debug build.

Richard
Nov 11 2002
parent reply Christof Meerwald <cmeerw web.de> writes:
On Mon, 11 Nov 2002 17:05:43 +0000 (UTC), Richard wrote:
 When I try:
 #include <iostream>
 void main(int argc, char *argv[])
 {
 __debug int HD = 1;
 __debug(HD)cout << "working" << endl;
 }
Works for me. Are you sure you are compiling with "-D"? (btw, "-DDEBUG" or "-DDEBUG=1" doesn't work) bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Nov 11 2002
parent reply Richard <fractal clark.net> writes:
In article <aqor8e$105r$1 digitaldaemon.com>, Christof Meerwald says...

Works for me. Are you sure you are compiling with "-D"? (btw, "-DDEBUG" or
"-DDEBUG=1" doesn't work)
Again? I think I'm getting a complex.. Ok, I'm using the IDE.. what switch do I need to use to get it to add -D to the sc build? And isn't -D just a notice for defines?? btw, the IDE has some real problems handling .def .mak .prj and .opn files. If I try and get clever with saving .opn files to match particular builds, something about the automatic parse causes the .def file to overwrite my defines line in settings. Eventually, I can get things screwed up enough to require delete of def and .mak. And sometimes even delete of the .prj file and start from scratch. But, I suppose it works for you.. sigh. Richard
Nov 11 2002
parent reply "Walter" <walter digitalmars.com> writes:
-D isn't really supported by the IDDE, need to use it on the command line.
Sorry. I'll add that to the bug list for the IDDE.

"Richard" <fractal clark.net> wrote in message
news:aqot8h$12i7$1 digitaldaemon.com...
 In article <aqor8e$105r$1 digitaldaemon.com>, Christof Meerwald says...

Works for me. Are you sure you are compiling with "-D"? (btw, "-DDEBUG"
or
"-DDEBUG=1" doesn't work)
Again? I think I'm getting a complex.. Ok, I'm using the IDE.. what switch
do I
 need to use to get it to add -D to the sc build? And isn't -D just a
notice for
 defines??

 btw, the IDE has some real problems handling .def .mak .prj and .opn
files. If I
 try and get clever with saving .opn files to match particular builds,
something
 about the automatic parse causes the .def file to overwrite my defines
line in
 settings. Eventually, I can get things screwed up enough to require delete
of
 def and .mak. And sometimes even delete of the .prj file and start from
 scratch.

 But, I suppose it works for you.. sigh.

 Richard
Nov 11 2002
parent reply Jan Knepper <jan smartsoft.us> writes:
Are you sure?
There was a trick with the "Defines" area in the IDDE...
Jan



Walter wrote:

 -D isn't really supported by the IDDE, need to use it on the command line.
 Sorry. I'll add that to the bug list for the IDDE.
Nov 12 2002
parent reply "Walter" <walter digitalmars.com> writes:
Yes, you can work around it that way, but it's a kludge.

"Jan Knepper" <jan smartsoft.us> wrote in message
news:3DD165C5.D4B34E58 smartsoft.us...
 Are you sure?
 There was a trick with the "Defines" area in the IDDE...
 Jan



 Walter wrote:

 -D isn't really supported by the IDDE, need to use it on the command
line.
 Sorry. I'll add that to the bug list for the IDDE.
Nov 12 2002
parent Jan Knepper <jan smartsoft.us> writes:
Walter wrote:

 Yes, you can work around it that way, but it's a kludge.
It certainly is a KLUDGE! Jan
Nov 13 2002