Skip to content

IPAddress.h defines variable INADDR_NONE #461

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

Open
pianistrevor opened this issue Feb 22, 2022 · 2 comments · May be fixed by #329
Open

IPAddress.h defines variable INADDR_NONE #461

pianistrevor opened this issue Feb 22, 2022 · 2 comments · May be fixed by #329

Comments

@pianistrevor
Copy link

The header file has a line:
const IPAddress INADDR_NONE(0,0,0,0);
Which means every file that includes this header will be assigned its own INADDR_NONE. Projects with limited static memory will encounter problems when this file is included in many .cpp files.

A suggested workaround (which I have confirmed works) would be to make IPAddress.h say extern const IPAddress INADDR_NONE; and define the actual variable in IPAddress.cpp as const IPAddress INADDR_NONE(0,0,0,0);

@per1234 per1234 linked a pull request Feb 22, 2022 that will close this issue
@per1234
Copy link
Contributor

per1234 commented Feb 22, 2022

Thanks for your suggestion @pianistrevor!

There was a previous report of this arduino/Arduino#1007

It was considered resolved by doing just what you suggested in the arduino/ArduinoCore-API repository:
arduino/ArduinoCore-API@3dbd7d7

However, the "Arduino AVR Boards" core has not yet transitioned to using ArduinoCore-API(#329), so the issue persists in this core.

@pianistrevor
Copy link
Author

pianistrevor commented Feb 22, 2022

Good to know, thank you! Will this be something this core does in the future, or should I plan to configure a different board? I’m currently using a CI framework that installs AVR...

edit: I looked at the PR, if the owner doesn’t make the changes I would happily consider doing my own version of this with appropriate changes

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 a pull request may close this issue.

2 participants