Skip to content

Assumption that EOF is enclosed in parantheses (example: (-1)); otherwise compilation error #1288

Closed
@JayFoxRox

Description

@JayFoxRox

Previously discussed at DevSolar/pdclib#20 (comment).

These 2 problems exist in jsoncpp:

  1. EOF is used in a way that might break certain C implementations (in our case, pdclib for C + libcxx for C++, with clang as compiler). The code assumes that EOF will provide paranetheses for dynamic_cast:
    std::getline(is, doc, static_cast<char> EOF);
  2. EOF isn't a char, but it's used as if it is. EOF is also not very strictly defined, so the behavior will be C implementation defined. Typically you get either a char (cast to int) or an EOF (int) as return value from functions like getchar().

Point 1 is easily fixed, but 2 shows that it might not be necessary to fix it - the problematic code needs to be rewritten.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions