7 Jun 2011 11:40
[skalibs] Why no negative numbers in the *_fmt routines?
Lloyd Zusman <ljz <at> asfast.com>
2011-06-07 09:40:02 GMT
2011-06-07 09:40:02 GMT
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.(Continue reading)
RSS Feed