Skip to content

Integer signedness in API is inconsistent #80

@GBertholon

Description

@GBertholon

Currently with modern compilers, using the API of this library can generate a lot of warnings, or useless conversions simply because the API is not consistent about signedness of its integers...
To give a single example, in Tmx::MapTile, id is unsigned but in Tmx::Tileset::GetTile, the argument is a signed integer.

I really thing that most interfaces should be changed to unsigned to avoid conversions on std::vector indexing, and restore internal consistency.

This may cause compatibility issues, so I think we should keep the old versions but mark them deprecated and remove them at next major version. This may prevent some changes inside public members.

If there is more problem in the API, we could also directly work on a next version release and rework API even more in the process.

In either case, this issue requires some amount of manual work to list all the misuses of signed int, and classify them correctly. However, compiler warnings on signed to unsigned conversion can help a lot to speed up the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions