Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #25997

Re: adding debugs in the code

From Eric Sosman <esosman@ieee-dot-org.invalid>
Newsgroups comp.lang.c
Subject Re: adding debugs in the code
Date 2012-09-06 07:52 -0400
Organization A noiseless patient Spider
Message-ID <k2a2qc$oij$1@dont-email.me> (permalink)
References <54f537cc-0b1a-4957-8a46-faa394279a00@googlegroups.com>

Show all headers | View raw


On 9/6/2012 12:47 AM, sinbad wrote:
> i often find adding debugs, ruins the readability of the code.
> i've checked many projects, where in often each debug statement
> spans 7 to 8 lines, which makes the code look ugly and even
> incomprehensible. so here's my question, are there any techniques
> that can be used to add debugs in a clean manner. i know it sound
> not much like a C related question at first, but, i am looking if
> c-lang has anything to offer in this regard.

     If a piece of debugging logic must do a lot of stuff, it
will require a non-trivial amount of code.  This will be true
no matter what language is used.  If the debugging code is
repetitive, there may be ways to condense some of the repetition
away.

     A few C features are specifically designed for debugging
and tracing: The __FILE__ and __LINE__ preprocessor macros,
the __func__ string, and of course the assert() macro.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid
"The speed at which the system fails is usually not important."

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

adding debugs in the code sinbad <sinbad.sinbad@gmail.com> - 2012-09-05 21:47 -0700
  Re: adding debugs in the code Ian Collins <ian-news@hotmail.com> - 2012-09-06 16:51 +1200
  Re: adding debugs in the code Don't make my brown eyes China Blue <chine.bleu@yahoo.com> - 2012-09-05 22:47 -0700
  Re: adding debugs in the code Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-06 07:52 -0400
  Re: adding debugs in the code Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-09-06 13:50 +0000
  Re: adding debugs in the code ImpalerCore <jadill33@gmail.com> - 2012-09-06 07:54 -0700
  Re: adding debugs in the code ralph <nt_consulting64@yahoo.com> - 2012-09-06 12:09 -0500

csiph-web