Closed
Description
Currently, IPADDRESS.H both declares and defines INADDR_NONE.
If a sketch has more than one file that includes IPAddress.h, then multiple copies of INADDR_NONE end up in the final executable. Essentially, each CPP file gets its own copy as a global variable, at 6 bytes a pop.
If the declaration in IPAddress.h is changed to:
extern const IPAddress INADDR_NONE;
and a new definition is provided in IPAddress.cpp:
const IPAddress INADDR_NONE(0, 0, 0, 0);
then only one copy end up in the executable.
My sketch went from 2002 bytes 'Minimum Memory Usage' to 1888 bytes, a savings of 78 bytes in my case.