1. 15
  1.  

  2. 6

    In the README it says libzahl isn’t thread safe. I’ve just recently started touching C code a little bit more often, what would it take to make this library thread safe? Is it shared memory or other state/variables across function calls or is it some weird C-specific memory thing?

    1. 3

      Well, the documentation seems to suggest that calculated values are stored in global state, so that is likely at least one thing that might lead to threading being unsafe.

    2. 4

      I wonder what make it says that “GMP MP cannot be used for robust programs.”

      1. [Comment removed by author]

        1. 6

          I couldn’t find an area in the library where exit was called. Procedure

          apt-get source libgmp10
          cd gmp*
          # exclude standalone tests, demos, tools for generating data and performance testing
          grep --include="*.c" -iR exit | grep -v test | grep -v demos | grep -v gen | grep -v tune
          

          Maybe it’s hidden as an abort() or something? [edit] I’d consider judicious use of abort() to be a feature not a bug. Robust software isn’t software that continues running no matter what. If an error occurs it’s best to return it, but if an essential pre or post condition is violated, signalling BUG via abort() seems like a good idea.

          1. 6

            I’m skeptical. libgmp is used by a lot of software, and searching didn’t turn up any results of that being a problem for anybody.

            Even if it were a problem, it would have been better to submit a patch than to write a new incompatible library, IMO.

            1. 2

              Do you know why exit is called at all? I’m asking out of curiosity.