Skip to content

ssize_t and other libraries aren't playing nice together #537

Description

@MarkVabulas

On line 19 in IXSocket.h, there is a typedef which reads:

typedef SSIZE_T ssize_t;

This is causing a conflict with another common library which contains the code:

typedef SSIZE_T long;

Would it be possible to push a change wrapping the SSIZE_T typedef it a #define guard:

#ifndef SSIZE_T
#define SSIZE_T ssize_t;
#endif

or alternatively with an undef such as:

#ifdef SSIZE_T
#undef SSIZE_T
#endif

I saw elsewhere it was suggested using the type std::ssize_t instead, but since that's not defined, why not change to use something like std::ptrdiff_t instead? After all, what you're passing around in the IXSocket class is usually pointer differences anyway.... It is considered bad practice to include C headers from C++ anyway, especially in header files. Including basestd.h uniquely for SSIZE_T seems like an anti-practice.

Using std::ptrdiff_t would not cause an ABI break as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions