Skip to content

Remove dependency to the math library.#103

Open
per-ok wants to merge 4 commits into
json-parser:masterfrom
per-ok:remove-dependency-to-the-math-lib
Open

Remove dependency to the math library.#103
per-ok wants to merge 4 commits into
json-parser:masterfrom
per-ok:remove-dependency-to-the-math-lib

Conversation

@per-ok

@per-ok per-ok commented Aug 3, 2021

Copy link
Copy Markdown
Contributor

Introducing json_pow10(), a fast power of 10 calculator, which suits JSON perfectly. (Named json_pow10 to avoid conflict with gcc builtin functions.)

@LB-- LB-- left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a compile option, as people who are already linking the math library anyway might want the reduced code size of using the existing pow function, or they may even wish to provide their own version of the function. Having the ability to not need the math library is appreciated though!

@per-ok

per-ok commented Aug 11, 2021

Copy link
Copy Markdown
Contributor Author

I will add compilation directives for this. How about using JSON_INTERNAL_MATH to actively remove the dependency?

New headline should possibly "add option to remove dependency to math.h" or similar?

@LB--

LB-- commented Aug 14, 2021

Copy link
Copy Markdown
Member

That sounds like a good plan to me!

@LB-- LB-- added this to the v1.2.0 milestone Aug 14, 2021
@per-ok

per-ok commented Oct 30, 2023

Copy link
Copy Markdown
Contributor Author

I thought I should complete what I started (and left unfinished) about 2 years ago. I see there is a build error in the verification process "CI / build-msvs (amd64_x86) (pull_request)" that is related to command line options:

cl : Command line error D8016 : '/std:c11' and '/Za' command-line options are incompatible

I cannot see how I can fix this.

@ghost

ghost commented Nov 1, 2023

Copy link
Copy Markdown

I cannot see how I can fix this.

I don't have visual studio, so can't say for sure, but I suppose Za involves C++98, which would indeed be incompatible with C++11, as the language changed so much that I consider C++11 a different (much better) lang.

@per-ok

per-ok commented Nov 9, 2023

Copy link
Copy Markdown
Contributor Author

This paragraph indicates that the /Za option applies to C89/90, only, and possibly does not apply to the /std:c11 and /std:c17 options.

@LB--

LB-- commented Apr 6, 2024

Copy link
Copy Markdown
Member

Apologies for the delay, I've fixed the CI - try rebasing and it should work properly now. Thanks to @per-ok for the hint.

Per Olav Kroka and others added 4 commits April 9, 2024 08:22
Introducing json_pow10(), a fast power of 10 calculator,
which suits JSON perfectly. (Named json_pow10 to avoid
conflict with gcc builtin functions.)
This make use of the math library the default.
This adds the -DJSON_INTERNAL_MATH on the compiler command line by which
the dependency to the math library is removed and internal functionality
is used instead.
@per-ok per-ok force-pushed the remove-dependency-to-the-math-lib branch from 9507a88 to f508768 Compare April 17, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants