|
From: Dirk M. <dm...@gm...> - 2007-10-04 21:30:58
|
On Thursday, 4. October 2007, Nicholas Nethercote wrote: > Making things more ANSI would be good My primary concern was to ensure that no format string mismatches occur that could cause strange misbehaviour or crashes on rare (possible not regression tested) scenarios. > , but then the ',' prefix is also > extremely useful -- it inserts commas into printed numbers, eg. prints > "1,234,567" instead of "1234567". Any ideas for how to get the best of > both worlds? There is one death to die. For now, we can keep the ',' prefix as long as gcc does not complain about it. Otherwise we have to either overload the meaning of one of the ANSI format string characters with it - e.g. '00' could mean comma insertion instead of zero extension, or remove the flag alltogether. the only fully ANSI correct solution would be to use %s and wrap the actual integer in a "comma_convert_decimal()" helper routine which formats the number and returns a pointer to a string instead. Greetings, Dirk |