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

Add const qualifier for TcpClient::isReconnect() method. #460

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Guo-Shiyu
Copy link

No description provided.

@ithewei
Copy link
Owner

ithewei commented Nov 13, 2023

这个不加const会有什么影响吗?

@Guo-Shiyu
Copy link
Author

Guo-Shiyu commented Nov 15, 2023

In my use case, the following code will cause a compile error without compile flag -fpermissive .

void f(const hv::TcpClient* raw) { // or `const hv::TcpClient&`
    if (raw->isReconnet()) {
        ... 
    } 
    // compile error: `raw` has type `const hv::TcpClient*` but member function
    // `TcpCLient::isReconnect()` not marked as const.

}

Add const qualifier for this method will not intruduce any incompatibility to existed code. So it would be a good fix?

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.

None yet

2 participants