Skip to content

IPAddress.h defines variable INADDR_NONE #461

Open
@pianistrevor

Description

@pianistrevor

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);

Activity

linked a pull request that will close this issueModification of ArduinoCore-avr to use API #329on Feb 22, 2022
per1234

per1234 commented on Feb 22, 2022

@per1234
Contributor

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

pianistrevor commented on Feb 22, 2022

@pianistrevor
Author

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      IPAddress.h defines variable INADDR_NONE · Issue #461 · arduino/ArduinoCore-avr