[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] TCC and external variables - am I not seeing somethin
From: |
Daniel Glöckner |
Subject: |
Re: [Tinycc-devel] TCC and external variables - am I not seeing something? |
Date: |
Sun, 10 Mar 2013 01:12:33 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Sun, Mar 10, 2013 at 12:31:11AM +0100, Aleksandar Kuktin wrote:
> The compiler I normally use is GCC, which has no problems about linking
> these files.
Unless you compile with -fno-common
> Header files have this:
>
> /*extern*/ nbworks_do_align_t nbworks_do_align;
It is bad practice to have variable definitions in a header.
Add the extern to make it a declaration. Then add the definition
to a single source file in your project.
> Source files have this:
>
> struct thread_cache *
> daemon_internal_initializer(struct thread_cache *tcache) {
> extern nbworks_do_align_t nbworks_do_align;
Why declare the variable inside the function if you have a header
with a definition/declaration?
Daniel