arduino / arduino/ArduinoCore-avr

IPAddress.h defines variable INADDR_NONE

Open
#461 3 comments 0 reactions 0 assignees Claimed by @giulcioffi View on GitHub
enhancement
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with IPAddress.h and IPAddress.cpp, where INADDR_NONE is declared and defined. Change the declaration and definition as described in the issue, then verify that projects including IPAddress.h in multiple .cpp files no longer create duplicate instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.