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

[FIX] fix InetAddress compile, and use getaddrinfo instead of gethostbyname_r #709

Open
wants to merge 2 commits into
base: cpp17
Choose a base branch
from

Conversation

Simonhancrew
Copy link

@Simonhancrew Simonhancrew commented May 31, 2024

@chenshuo

cpp17, compile issue occurs

muduo/muduo/net/InetAddress.cc:50:35: error: expected primary-expression before ‘,’ token
   50 | static_assert(offsetof(sockaddr_in, sin_family) == 0, "sin_family offset 0");

my gcc version

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And InetAddress::resolve use gethostbyname_r , maybe we should use getaddrinfo instead

@ggandycong
Copy link

ggandycong commented May 31, 2024 via email

@Simonhancrew Simonhancrew changed the title [FIX] compile: forget to add stddef.h, compile error in gcc-11.4.0 [FIX] InetAddress compile, and use getaddrinfo instead of gethostbyname_r Jun 3, 2024
@Simonhancrew Simonhancrew changed the title [FIX] InetAddress compile, and use getaddrinfo instead of gethostbyname_r [FIX] fix InetAddress compile, and use getaddrinfo instead of gethostbyname_r Jun 3, 2024
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

Successfully merging this pull request may close these issues.

2 participants