On Thu, Feb 2, 2012 at 11:08 PM, Alexey Borzenkov <[email protected]> wrote:
> However, `extern int var' inside a function wouldn't be a
> tentative definition, and would have linkage external.
Ah, I think I see it now. It wouldn't have linkage external, because
it should take linkage from previously seen declaration (and
experiments with gcc show that this is what happens in both gcc and
clang). But then, in ev.h, EV_API_DECL is always defined as either
static or extern, and in those cases:
1. When EV_API_DECL is static, then extern struct ev_loop
*ev_default_loop_ptr in ev_default_loop_uc_ is redundant, as there's
prior declaration visible, and resulting linkage is internal.
2. When EV_API_DECL is external, then extern struct ev_loop
*ev_default_loop_ptr in ev_default_loop_uc_ is redundant, as there's
prior declaration visible, and resulting linkage is external.
Now clang does indeed have something fishy, because this:
static int var;
int func() {
extern int var;
return var;
}
int var = 0;
Gives a correct error on gcc, but compiles fine on clang. It seems
like declarations inside functions mess with storage classes somehow.
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev