← Back to team overview

kicad-developers team mailing list archive

Re: Be careful with static const members

 

Can this be the reason for the behaviour described in this bug thread?

https://bugs.launchpad.net/kicad/+bug/1315885/comments/19

2014-05-18 21:56 GMT+02:00 Lorenzo Marcantonio <l.marcantonio@xxxxxxxxxxxx>:
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References