format argument to g_ascii_dtostr
- From: Owen Taylor <otaylor redhat com>
- To: timj gtk org, alexl redhat com
- Cc: gtk-devel-list gnome org
- Subject: format argument to g_ascii_dtostr
- Date: 24 Oct 2001 11:27:39 -0400
Hi Tim,
A comment I added to http://bugzilla.gnome.org/show_bug.cgi?id=62012;
apparently the format argument is your suggestion.
I absolutely hate the format argument to g_ascii_dtostr.
If you are formatting for human consumption, then you
don't want to use this function. If you are not formatting
for human consumption, then you really, really should
not be forced to enter "%.17g"
G_ASCII_DTOSTR_BUF_SIZE
Becomes useless when you force people to literally supply
%.17h.
If we absolutely have to have this feature, then we should
have a _separate_ g_ascii_formatd or something that takes
the format, and make the normal function convenient
for normal uses.
(People might suggest #define G_ASCII_DTOSTR_FORMAT "%.17g",
or making NULL mean "%.17g. I don't think either is much
of an improvement. Keeping it simple means eliminating that
argument.)
The purpose of g_ascii_dtostr() is to provide a convenient and
reliable way to serialize doubles. Forcing people to supply
a format is incompatible with that. If it will settle the
issue, I'm OK with having g_ascii_formatd() in addition, though
I don't think it is all that useful.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]