Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MarkVabulas opened this issue Dec 22, 2024 · 0 comments
Open

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

MarkVabulas opened this issue Dec 22, 2024 · 0 comments

Comments

@MarkVabulas
Copy link

MarkVabulas commented Dec 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant