delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/17/13:15:31

From: "Rafał Maj" <r_maj AT poczta DOT onet DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Odp: big program with macros
Date: Thu, 17 Aug 2000 18:28:10 +0200
Organization: Academic Computer Center CYFRONET AGH
Lines: 45
Message-ID: <8nh5qj$h21$1@info.cyf-kr.edu.pl>
References: <8ndkcu$lt8$1 AT info DOT cyf-kr DOT edu DOT pl> <8ne316$jmi$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <8ngd0u$nsv$1 AT info DOT cyf-kr DOT edu DOT pl> <8ngk5n$c2c$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <8ngta7$27b$1 AT info DOT cyf-kr DOT edu DOT pl> <8ngvmp$hr2$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: d-94-53-08.cyfronet.krakow.pl
X-Trace: info.cyf-kr.edu.pl 966531731 17473 149.156.1.168 (17 Aug 2000 17:02:11 GMT)
X-Complaints-To: news AT cyf-kr DOT edu DOT pl
NNTP-Posting-Date: 17 Aug 2000 17:02:11 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote :
> I.e. you have to recompile at least part of your program whenever you
> want to debug a different class.

 I don't now yet how to write own libraries etc..., and now I'm always
recompiling all program (but on 525Mzh + 8MB ram disk it works fine)

> Or you could have a central 'debugflags.h' that collects such
> #defines, and include that everywhere.  As is, you're stuffing your
> code with debug-output statements that aren't ever executed. That's a
> waste of execution time and program size.

Yes, I have few debug options in "dbg_cfg.h", declared like   #define
DBG_ECHO 1  #define DBG_LEVEL 2

When my program works correctly, I can change  #define DBG_ALL 1   to
#define DBG_ALL 0 and then *ALL*
debug macros, additional variables in classes etc... aren't compile - so
program is smaller, and it's compiling and executing faster.

> Another question that keeps popping up in my mind, as we discuss this:
> why not use a proper debugger, instead of trying to do it by hand?
[..]
> It's so much easier to make sense out of variable contents and other
> information like it if you can observe exactly what you want, at any
> given point of execution of the program and of your analysis of the
> problem.

I now how to use debugger, and I now that it is much more comfortable.

However :  my program is using SVGA graphics and allegro keyboard / mouse
handler, so I can't debug it like this.

> A debugger lets you do that without wading through megabytes
> of debug output that turns out not to be needed most of the time
Program can wrtie to separated files like "init.dbg", "warnings.dbg",
"mem.dbg".
Normal debug output have less then 300 lines.

Often I use macros to print statistics informations - how long it took to
load graphics files, how often program have to unload some data from memory,
etc...



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019