← Back to team overview

kicad-developers team mailing list archive

Be careful with static const members

 

Doing today merge, in router_preview_item.h:

    static const int ClearanceOverlayDepth = -2000;
    static const int BaseOverlayDepth = -2020;
    static const int ViaOverlayDepth = -2046;

... the *declaration* is OK, however there is no *definition*. This is not
valid C++. At higher optimization levels it compiles since the compiler
inlines the value, however at -O0 it couldn't link... already happened
in the past.

Reason: even if it's something is static const it could be have its
address taken, so it must have a definition somewhere (presumably in
router_preview_item.cpp)

Yes, it's a nuisance but the standard says so :P

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups