Giter VIP home page Giter VIP logo

nanojson's People

Contributors

ttsuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nanojson's Issues

Won't compile

Hello, thanks for sharing this project. I'm very interested to use it, but I'm running into issue when compiling 'test.cpp'. I tried using the following options, all result in compile errors:

-std=c++98
-std=c++03
-std=c++11
-std=c++14
-std=gnu++98
-std=gnu++03
-std=gnu+=11
-std=gnu++14

Here's the output from one of my attempts:
$ g++ -std=c++11 test.cpp -o test
In file included from test.cpp:10:0:
nanojson.h:453:14: error: explicit specialization in non-namespace scope ‘class nanojson::element::element_writer’
template <>
^
nanojson.h:454:82: error: template-id ‘snprintf’ in declaration of primary template
static void snprintf(char buffer, size_t bufferCount, char format, ...)
^
nanojson.h:475:12: error: field ‘result’ has incomplete type ‘nanojson::element’
element result;
^
In file included from test.cpp:10:0:
nanojson.h:73:9: note: forward declaration of ‘struct nanojson::element’
struct element
^
In file included from test.cpp:10:0:
nanojson.h: In static member function ‘static nanojson::element::string_t nanojson::element::element_writer::encode_string(const string_t&)’:
nanojson.h:438:71: warning: ISO C++ forbids converting a string constant to ‘char
’ [-Wwrite-strings]
snprintf(buf, bufsz, "\u%04X", static_cast(src[i]) & 0xFF);
^
nanojson.h: In instantiation of ‘static nanojson::element nanojson::element::from_iterator(T, T) [with T = __gnu_cxx::__normal_iterator<const char
, std::__cxx11::basic_string >]’:
nanojson.h:255:49: required from here
nanojson.h:280:40: error: invalid initialization of non-const reference of type ‘nanojson::element::from_iterator(T, T) [with T = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string >]::reader&’ from an rvalue of type ‘nanojson::element::from_iterator(T, T) [with T = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string >]::reader’
return element_reader::parse(reader(first, last));
^
nanojson.h:468:19: note: initializing argument 1 of ‘static nanojson::element nanojson::element::element_reader::parse(istream&) [with istream = nanojson::element::from_iterator(T, T) [with T = __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string >]::reader]’
static element parse(istream &src)
^
nanojson.h: In instantiation of ‘static nanojson::element nanojson::element::from_iterator(T, T) [with T = const char*]’:
nanojson.h:260:73: required from here
nanojson.h:280:40: error: invalid initialization of non-const reference of type ‘nanojson::element::from_iterator(T, T) [with T = const char*]::reader&’ from an rvalue of type ‘nanojson::element::from_iterator(T, T) [with T = const char*]::reader’
return element_reader::parse(reader(first, last));
^
nanojson.h:468:19: note: initializing argument 1 of ‘static nanojson::element nanojson::element::element_reader::parse(istream&) [with istream = nanojson::element::from_iterator(T, T) [with T = const char*]::reader]’
static element parse(istream &src)

Low compiler compatibility due to to_chars / Elementary string conversions (+ floating point)

https://en.cppreference.com/w/cpp/compiler_support/17
Compiler support for the Elementary string conversions* feature is currently limited to gcc 11 and MSVC 19.24.
I'm unable to compile nanojson2 with Debian 11's clang and gcc packages.
gcc 11 is not available in Debian 11.

The Debian 11 Hard Freeze was on 2021-03-12, which happens to be in between the release of clang-11 and gcc-11

$ cat /etc/debian_version
11.3

$ g++ --version
g++ (Debian 10.2.1-6) 10.2.1 20210110

$ clang++-11 --version
Debian clang version 11.0.1-2

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.