-
-
Couldn't load subscription status.
- Fork 7k
Make some operators in IPAddress const #1798
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
Make some operators in IPAddress const #1798
Conversation
|
Applying const to methods is good, but for some reason it breaks the AdvancedChatExample, may you check that? May you also apply the patch to the SAM core? |
|
What example do you mean exactly? I tried the AdvancedChatServer example, which compiles normally (though it seems to use too much memory when for the Arduino Ethernet, but that's also without my patch applied). What board are you using? What error are you seeing? |
|
Yes the example is AdvancedChatServer, I'm compiling for Arduino Uno, it gives: Maybe you should add the "const" on the operator== implementation in IPAddress.cpp |
|
Yeah I should, I'm almost certain that's the problem. I also realized why I couldn't reproduce it: The build/linux/work/hardware directory still had the core files from the last time I ran "ant", I didn't realize that I did a "regular" build that copies those files instead of symlinks a while ago. I'll push an updated patch with both things fixed in a minute, thanks for having a look. |
These functions do not modify the IPAddress object, but were not marked
as const. This meant that you could not do:
void set_ip(const IPAddress& ip) {
uint32_t copy = ip;
}
Since calling operator uint32_t() on ip would discard the constness of
the reference.
|
Here's the update. Also tested the AdvancedChatServer example for the Due. |
arduino/Arduino#1798 was merged, so this is no longer needed. This means that this code will only work with a recent nightly build, the Arduino 1.5.6 release does not have this fix yet.
arduino/Arduino#1798 was merged, so this is no longer needed. This means that this code will only work with a recent nightly build, the Arduino 1.5.6 release does not have this fix yet.
arduino/Arduino#1798 was merged, so this is no longer needed. This means that this code will only work with a recent nightly build, the Arduino 1.5.6 release does not have this fix yet.
These functions do not modify the IPAddress object, but were not marked
as const. This meant that you could not do:
void set_ip(const IPAddress& ip) {
this->ip = ip;
}
Since calling operator uint32_t() on ip would discard the constness of
the reference.