Skip to content

Misuse of _POSIX_C_SOURCE feature macro #318

@RhodiumToad

Description

@RhodiumToad

As a general rule, it's not desirable for a library's public header file(s) to try and define feature macros such as _POSIX_C_SOURCE. The place to do that is either in the compiler flags, or in a private header file.

The reason why it's a problem is that it potentially messes with the namespace/feature choices of clients of the library - but only if they happen to #include "maxminddb.h" before including any standard header. If instead they include it after some other header, that's even worse: the result is undefined.

(I've seen #158 and #267 for some context for why you're defining this, but it remains that you're doing it in the wrong place, in a way that can cause build failures for client code - an example of which I've just spent an hour or two assisting someone to fix.)

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