Comments (13)
Hmm, this is a known bug from 2007. Too bad it isn't fixed in whatever version of libstdc++ is used on OSX
http://gcc.gnu.org/ml/libstdc++/2007-11/msg00075.html
http://openbsd.7691.n7.nabble.com/Patch-to-fix-libstdc-std-showpos-td162922.html
from tinyformat.
Yup, this was fixed by the gcc guys all the way back in 2007:
from tinyformat.
Bah, the above link is out of date now, here's an updated one:
Which links to a diff as follows
--- trunk/libstdc++-v3/include/bits/locale_facets.tcc 2007/11/27 01:03:54 130459
+++ trunk/libstdc++-v3/include/bits/locale_facets.tcc 2007/11/27 01:59:41 130460
@@ -874,13 +874,13 @@
if (__builtin_expect(__dec, true))
{
// Decimal.
- if (__v > 0)
+ if (__v >= 0)
{
if (bool(__flags & ios_base::showpos)
&& __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
*--__cs = __lit[__num_base::_S_oplus], ++__len;
}
- else if (__v)
+ else
*--__cs = __lit[__num_base::_S_ominus], ++__len;
}
else if (bool(__flags & ios_base::showbase) && __v)
from tinyformat.
Ok, this should be fixed with the commit above, but I'll need someone with an older OSX machine to say for sure. @lgritz would you be willing to give this a go? Just run a tinyformat "make test" and all tests should pass... I hope.
from tinyformat.
Sure, I'll give it a try when I get a chance. May have to wait until later today or tomorrow, I've got a full day today.
from tinyformat.
I hate to throw this back at you, Chris, but when I incorporated this latest tinyformat.h into OIIO, I get other errors related to how strutil.h declares 'Strutil::format' using TINYFORMAT_WRAP_FORMAT, and I'm not quite sure what to do to fix it.
from tinyformat.
This is probably because in OIIO we used more than 10 parameters so I had to rerun the cog code generated code which makes those horrible macros for the varags emulation.
Before we get into OIIO integration, I'd really just like to know whether the recent patch fixes the problems you were seeing on the tinyformat side. The tests in the tinyformat repo include a test for "%+d" so if you could just run those and confirm the fix then I'm happy to make a pull request to integrate the changes. (Clone the latest tinyformat and run "make test" - that should do it.)
from tinyformat.
Thanks for having a look by the way :)
I suppose I could up the default max number of parameters to tfm::format, since OIIO is already a case where 10 is too few.
from tinyformat.
$ make
/Users/lg/bin/g++ -Wall --std=c++98 -DTINYFORMAT_NO_VARIADIC_TEMPLATES tinyformat_test.cpp -o tinyformat_test_cxx98
/Users/lg/bin/g++ -Wall --std=c++0x -DTINYFORMAT_USE_VARIADIC_TEMPLATES tinyformat_test.cpp -o tinyformat_test_cxx0x
cc1plus: error: unrecognized command line option "-std=c++0x"
But it does nonetheless make tinyformat_test_cxx98.
$ ./tinyformat_test_cxx98
(no output)
Does that mean it succeeded?
from tinyformat.
I think I'm gonna try adding a few more C++98 variants and see if that fixes. Maybe you're right, and 10 is just not enough. Stay tuned.
from tinyformat.
Yep, that means it succeeded. The error is presumably because you're using clang and it no longer allows "c++0x" to refer to the c++11 standard, whereas the version of gcc I have still insists on it?
Sorry this is turning into a rigmarole, I thought it would be as simple as "git clone && make test"
from tinyformat.
I made it work with OIIO by upping the number of supported parameters. I will send you a pull request.
from tinyformat.
Ok, fix confirmed, thanks Larry :)
from tinyformat.
Related Issues (20)
- Support for POSIX extension of positional arguments HOT 2
- const std::atomic actual parameter with requested alignment of 8 won't be aligned HOT 3
- Usage question: How to NOT display a parameter? HOT 1
- puts HOT 6
- Segmentation Fault with Intel Compiler HOT 10
- Cannot print volatile variables: error: invalid static_cast from type const volatile unsigned int* to type const void* HOT 1
- Why only 16 parameters instead of 32, 64, 128? HOT 7
- Use typename instead of class on TINYFORMAT_ARGTYPES? HOT 2
- Template program to count the number of format specifiers and check if they match the arguments count HOT 2
- Cannot print function pointer HOT 13
- Issues found during tinyformat audit (part of Bitcoin Core audit) HOT 5
- How to override the formatValue function?
- error: invalid static_cast from type โconst void*โ to type โvoid (*)()โ HOT 1
- Alter repository title or decouple from standard streams HOT 2
- Formatting NaN or infinity with explicit precision injects spurious zeros HOT 2
- Multiple symbol definitions after commit 9368985 HOT 2
- Passing -INF through %.16d still puts the minus sign at far-left HOT 1
- Different output for earlier compilers HOT 1
- Not enough conversion specifiers in format string HOT 4
- Update minimum CMake version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinyformat.