← Back to team overview

kicad-developers team mailing list archive

Re: data in headers

 

On Wed, May 22, 2013 at 03:05:29PM -0500, Dick Hollenbeck wrote:
> The more common practice is to use extern declarations in the header, and define the data
> in a *.cpp file.
> 
> 
> Why are you doing this?

*If* it's only used there, I think he simply wanted to put aside a big
definition block away from code. If these are a lot of definitions,
having to declare a lot of them *and* define them is almost a code
duplication.

IIRC it's the same with font data.

If that's the case nothing prohibit putting them in a .cpp file and
*including* it rather than linking it; i.e. just rename the file to
avoid getting it included. Otherwise put a magic ifdef so the compile
fails if it's not included by that cpp files.

Anyway IIRC since double definitions in C++ are forbidden even if
identical link should fail (but I'd test this before relying on it:D)

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups

References