Giter Site home page Giter Site logo

Comments (13)

c42f avatar c42f commented on August 15, 2024

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.

c42f avatar c42f commented on August 15, 2024

Yup, this was fixed by the gcc guys all the way back in 2007:

http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/locale_facets.tcc?r1=130233&r2=130460&diff_format=h

from tinyformat.

c42f avatar c42f commented on August 15, 2024

Bah, the above link is out of date now, here's an updated one:

http://gcc.gnu.org/viewcvs/gcc/trunk/libstdc%2B%2B-v3/include/bits/locale_facets.tcc?r1=130459&r2=130460&diff_format=h

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.

c42f avatar c42f commented on August 15, 2024

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.

lgritz avatar lgritz commented on August 15, 2024

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.

lgritz avatar lgritz commented on August 15, 2024

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.

c42f avatar c42f commented on August 15, 2024

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.

c42f avatar c42f commented on August 15, 2024

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.

lgritz avatar lgritz commented on August 15, 2024
$ 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.

lgritz avatar lgritz commented on August 15, 2024

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.

c42f avatar c42f commented on August 15, 2024

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.

lgritz avatar lgritz commented on August 15, 2024

I made it work with OIIO by upping the number of supported parameters. I will send you a pull request.

from tinyformat.

c42f avatar c42f commented on August 15, 2024

Ok, fix confirmed, thanks Larry :)

from tinyformat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.