pan-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pan-users] Bad authentication segfaults pan


From: Rhialto
Subject: Re: [Pan-users] Bad authentication segfaults pan
Date: Wed, 30 Jan 2013 23:11:26 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed 30 Jan 2013 at 16:36:20 +0000, Duncan wrote:
> (Meanwhile, fixing that static mutex thing would be nice, too.  I'm 
> dumbly patching out the static for now, but I guess that's the wrong 
> patch from what I've read right here, and I was actually wondering if 
> something with that might have been triggering the crash, before I found 
> out what it was.)

There is an obscure rule in C about what is called "tentative
definitions". Off the top of my head I think it is something like this:

- If you write something like this at file level:
  int a;
  then you have a "tentative definition" of a variable called a.
- If you write somewhere, at file level:
  int a = <some constant value>
  then you have a (normal) definition.
- In all the object files ("compilation units") that you link together,
  you can have only 1 definition for a name, but multiple tentative
  definitions is allowed. (I'm not sure if the combination of having
  both is also allowed but I expect it is).
- If you have only tentative definitions, one of those is converted to a
  normal definition.
- When linking, all tentative definitions are forgotten.

So, in principle, if you remove "static" from something in a header
file, you get a bunch of tentative definitions (one in each of the
source files you're including it in) and the linker will collapse them
to 1, and should not complain. As long as you don't add "= something" to
it.

This is what you are seeing, am I correct?

However, this rule is somewhat obscure, and mainly for compatibility
with old FORTRAN useage of linkers ("common blocks") and should be
avoided if possible.

> Duncan - List replies preferred.   No HTML msgs.
-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- The Doctor: No, 'eureka' is Greek for
\X/ rhialto/at/xs4all.nl    -- 'this bath is too hot.'




reply via email to

[Prev in Thread] Current Thread [Next in Thread]