supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Lloyd Zusman <ljz@asfast.com>
To: supervision@list.skarnet.org
Subject: [skalibs] Why no negative numbers in the *_fmt routines?
Date: Tue, 7 Jun 2011 09:40:02 +0000 (UTC)	[thread overview]
Message-ID: <loom.20110607T112320-148@post.gmane.org> (raw)

I want to use skalibs to support some software that I'm writing,
instead of the standard unix libraries. This is generally working
well and resulting in smaller, more efficient binaries, but I
have come across one issue that is giving me some difficulties:
the integer-based *_fmt routines do not format negative numbers.

It seems that this is due to the fact that this group of *_fmt
routines are all built on top of uint64_fmt_base(), which only
knows about unsigned positive values. This makes sense for
routines like uint_fmt() and ulong_fmt(), but it is causes problems
when passing perfectly valid integers and longs to int_fmt() and
long_fmt(), when these valid values happen to be less than zero.

Of course, I know how to work around this, but it seems like the
most efficient solution to this problem would be for skalibs to
handle negative values at the lowest level, perhaps through a new
int64_fmt_base() routine that would underlie int_fmt(), long_fmt(),
etc.

Is there any reason for why such a routine should not be written,
so that fmtscan.h could use it to build the macros for all the
signed-value routines such as int_fmt() and long_fmt()?

If no one has any objections, I'd be happy to write a patch to
skalibs which provides this functionality.

Thoughts?

Thanks.

-- 
 Lloyd Zusman
 ljz@asfast.com
 God bless you.




             reply	other threads:[~2011-06-07  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  9:40 Lloyd Zusman [this message]
2011-06-07 11:55 ` Lloyd Zusman
2011-06-07 12:08   ` [skalibs] long_fmt fails with FMT_LEN (was: Why no negative numbers in the *_fmt routines?) Lloyd Zusman
2011-06-07 13:52     ` Laurent Bercot
2011-06-08  0:13       ` Lloyd Zusman
2011-06-11 13:31       ` [skalibs] Can't post on the skaware mailing list (was: long_fmt fails with FMT_LEN) Lloyd Zusman
2011-06-11 15:37         ` Laurent Bercot

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=loom.20110607T112320-148@post.gmane.org \
    --to=ljz@asfast.com \
    --cc=supervision@list.skarnet.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).