From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Glynn Clements <glynn@gclements.plus.com>
Cc: C programming list <linux-c-programming@vger.kernel.org>
Subject: Re: library routine wrappers and serious overkill
Date: Mon, 6 Jun 2005 17:29:40 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.61.0506061725380.2617@localhost.localdomain> (raw)
In-Reply-To: <17059.41759.788362.757952@gargle.gargle.HOWL>
On Mon, 6 Jun 2005, Glynn Clements wrote:
> Robert P. J. Day wrote:
>
> > now, i'm as big a fan as the next guy of good debugging (the
> > my_CONDITION macro is a local implementation of assert() with hooks to
> > a logging library -- yeesh) but, seriously, there has to be a limit to
> > just how much debugging you're going to apply to each and every
> > string-related library routine. it does get kind of absurd after a
> > while:
> >
> > ===============================
> >
> > char
> > my_str_ch2upper(char const ch)
> > {
> > DBUG_ENTER(__FUNCTION__);
> >
> > if (isascii(ch) && islower(ch)) {
> > DBUG_RETURN(toupper(ch));
> > }
> > DBUG_RETURN(ch);
> > }
> >
> >
> > ===============================
> >
> > is this what you'd call best practice?
>
> It may be that the code was written for a platform which lacked a
> working debugger, so the program had to be able to generate its own
> stack traces etc.
in fact, that's exactly the case -- this code is for an embedded
system for which debugging capabilities are limited. my point was
more that it seemed like overkill to add "dbug"-type wrapping around a
routine that did nothing more than convert a character to upper case.
and, on top of that, the input validation above is redundant -- the
definition of "toupper" is that it already checks whether the input
character is lower case before performing the conversion.
in any case, i have no beef with debugging code. but i think there
are times when one gets a bit carried away.
rday
prev parent reply other threads:[~2005-06-06 21:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-05 21:34 library routine wrappers and serious overkill Robert P. J. Day
2005-06-06 1:13 ` Glynn Clements
2005-06-06 21:29 ` Robert P. J. Day [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0506061725380.2617@localhost.localdomain \
--to=rpjday@mindspring.com \
--cc=glynn@gclements.plus.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).