-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various issues in fprint. #26
Comments
Thanks. I'll look into this later. |
I'm getting around to this tonight. I have a few responses though.
This is a legitimate issue. I figure I might as well do it.
The entire string is called a format-string. It's divided into
Valid concern. I'll fix it.
I'll fix this too.
I see no purpose of supporting this at the moment since I have to compile with GCC 4.8 or higher. I'm not going to drop support for GCC 4.8 and 4.9 just for a single component. I might make a macro to solve this (similar to
Valid concern. I'll fix this. |
switch the + and p verbs for the format-spec. Fixes #26.
Fixed in a21a017. If you see anything else missing feel free to reopen this issue. |
Two things:
|
I'm not sure if number 1 is a really big issue. I don't explicitly see the confusion but I'll fix it anyway. With regards to number 2, I got to thinking and I realised the small subset of ASCII (i.e 0x00 - 0x7F) is probably not succumbed to widening. Only those that have a multi-byte representation in different locales do. I think ASCII is safe so 0x20 is guaranteed in at least Windows and Linux. So I might replace all the |
There are a lot of unnecessary null checks in fprint.h, for example (not all):
Gears/gears/io/fprint.hpp
Line 37 in c04125d
Gears/gears/io/fprint.hpp
Line 101 in c04125d
Potential issue: format string is totally ignored if no additional arguments were passed. You mentioned this was by design, but I strongly recommend you to reconsider it as it potentially breaks generic code that relies on fprint, and if a user really wants the faster "unformatted formatting" they can always resort to just calling
out << str
.Doc issue:
format-string
is a confusing identifier in your grammar since you have the format string, containing literal text andformat-string
s. See the issue? I suggest taking over Pythons terminology and calling it a "replacement field".Critical issue: formatting is not stateless, as you do not correctly set default fill parameters, and they can carry over from replacement field to replacement field. For example: https://gist.github.com/orlp/a0aba247345baaf8c393 I only checked this for fill, but the same probably applies to precision, align, width and potentially more.
Checking issue: you do not check if an integer came after the dot in
["." precision]
. An example invalid format string that you do not throw an exception on is|:.|
Missing feature:
std::hexfloat
- you said GCC didn't support this, but I list it here for completion anyway.Missing feature:
std::showpoint
- I suggest changingp
tostd::showpoint
and assigning+
tostd::showpos
.For ideas of how I solved some of these problems/set up my solution see https://github.com/orlp/libop/blob/master/bits/io.h .
The text was updated successfully, but these errors were encountered: