gdc and gcc object linking issues

Dmitry Olshansky dmitry.olsh at gmail.com
Thu Jun 7 12:57:48 PDT 2012


On 07.06.2012 23:04, Kagamin wrote:
> On Thursday, 7 June 2012 at 14:29:24 UTC, Regan Heath wrote:
>> In the quoted passage above I suspect he was referring to a
>> static/global variable defined in a C header, not a C++ class member
>> static or otherwise.
>
> I'm pretty sure you can define (with storage) global variable in header
> file both in C and C++.

Indeed you can. Kind of anti-pattern.

> But don't qualify it static in C: this will make
> it hidden symbol so you will have several instances of the variable but
> no symbol collision.

Some libraries actually count on something like this, but I can't 
remember offhand. Logging probably?

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list