inmotionsoftware / ims-json

Efficient json library implemented in portable C with a convenient C++11 interface.
3 stars 2 forks source link

Portability improvements #1

Open sbseltzer opened 7 years ago

sbseltzer commented 7 years ago

I've been evaluating this against some other options like frozen and parson for a portable library (I'd like to target Linux, OSX, Windows, iOS, Android) which is to be used by a low-profile RESTful server. There are three things that stand out to me about this library in terms of portability.

  1. for ( size_t i ... style declarations are only allowed in C99 and up. Windows won't complain about this, but GCC will.
  2. I've found this library has one dependency on platforms other than Windows so far. ceilf is implemented in libm (the math library) on Linux at least. It'd be nice to eliminate that.
  3. Use a portable build system for tests. It's not really fair to call a library portable when the only solution included is for a specific version of Visual Studio. Consider using CMake with CTest and maybe something like greatest.

There are also a number of nitpicky things in the header that could make this more suitable for quirky embedded systems (which the low-memory footprint lends itself to). I'll perhaps save those for a separate issue, though.

Let me know if you'd like help with any of these.

bghoward commented 7 years ago

Yes, I could definitely use some help on getting a more portable build system. For the most part the library is intended to be lightweight and embeddable in your project (single .c file and .h file, plus optional .hpp for C++).

If you know which dependencies are an issue, I can work on removing those.

sbseltzer commented 7 years ago

Yeah, that's how I've been using it. I only say build system so that users can more readily kick the tires on the tests/samples it comes with. The only dependency I've found thus far is libm on Ubuntu (probably on other *nix systems too) and I suppose the standard C library. The latter isn't all that important unless you want this to be usable on embedded systems, which is probably not your priority right now. ;)

sbseltzer commented 7 years ago

Speaking of, if I were to work on a PR, what is the branching strategy you prefer? Fork and work directly on master, or something else?