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

Compilation Error in clients/memflush.cc - Pointer and Integer Comparison #56

Open
datacow-com opened this issue Sep 24, 2024 · 0 comments

Comments

@datacow-com
Copy link

Description

Version: libmemcached 1.0.18
Operating System: Amazon Linux 2023

Issue Summary

I encountered a compilation error while trying to build libmemcached version 1.0.18. The error arises in the clients/memflush.cc file when comparing a pointer (opt_servers) to an integer (false), which is not permitted in ISO C++.

Steps to Reproduce

Clone the libmemcached repository or download the libmemcached-1.0.18 tarball.
Navigate to the source directory.
Run the following commands to configure and build:

./configure --enable-tls --with-openssl
make
Observe the compilation error.
Compilation Error
Here is the specific error message that was output during the build process:

CXX clients/memflush.o
clients/memflush.cc: In function ‘int main(int, char**)’:
clients/memflush.cc:42:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
42 | if (opt_servers == false)
| ~~~~~~~~~~~~^~~~~~~~
clients/memflush.cc:51:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
51 | if (opt_servers == false)
| ~~~~~~~~~~~~^~~~~~~~
make[1]: *** [Makefile:5832: clients/memflush.o] Error 1

Proposed Solution

The comparisons involving opt_servers should be modified to check against nullptr instead of false.

For example, changing:

if (opt_servers == false)
to:
if (opt_servers == NULL)
would resolve the compilation error.

Additional Information

I have verified that all required dependencies are installed.
This issue seems to stem from the handling of pointer types in the codebase.
Thank you for your attention to this matter. I look forward to any updates or solutions you might have regarding this issue.

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