From mint-bounce@lists.fishpool.fi Thu Dec 10 04:56:54 2009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=f+r/58fdNQiaIcxOpJjTZTHRhuC5AM9PDdztdMBVrcg=; b=uCjZEvWJ4N8HvU5QnjZOjS3zUjgLaklIkZTs3zsKfY3rUk+qmHWwG2WB97qxnquXc3 XFGHQ/TxuGtK/iyfj6qsJP0PxjPhIt01Oj85FzhrWGZF5KwXZtxzrft7JcEhbtTyd6wE sIC2KPgzm38JIaTl50qGIPwRwdhbQJT6yE3aY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=HGq3hGQ7k30QhOhx0DWPmaeuLHMz7fLHejwycZdsqiWEiIUpV6EICs2DKNzX5vu+w+ +ofRyOIpl0mWg4iHfcYoyVN6s2yl3lfNOHTyVTQFIFFextpTdJFEZbVVA6t/PufstS5D wQL0nWmPG9a7GYm/nitMvIgREVBzJLzCMQNws= MIME-Version: 1.0 In-Reply-To: <4B20C0B5.5010007@freesbee.fr> References: <11a6f2b10912100028l6bcb4671xafdac483b5caf82c@mail.gmail.com> <752526d20912100116n162523ecgb412973e2c51ca5f@mail.gmail.com> <4B20C0B5.5010007@freesbee.fr> Date: Thu, 10 Dec 2009 10:54:14 +0100 Message-ID: <752526d20912100154j2a42b983pf8132eca45930778@mail.gmail.com> Subject: Re: [MiNT] XaAES modifications and clarification From: =?ISO-8859-1?Q?K=E5re_Andersen?= To: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= Cc: mint Content-Type: text/plain; charset=ISO-8859-1 X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: kareandersen@gmail.com Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.sparemint.org id nBA9urMe010217 2009/12/10 Vincent Rivière : > Kåre Andersen a écrit : >>> >>> struct remember_alloc; // ??? >>> struct remember_alloc >>> { >>>       struct remember_alloc *next; >>>       void *addr; >>> }; >>> >>> what is happening here, why the double declaration (see: ???) >> >> Not a double declaration; The "empty" statement is a declaration, the >> second is a definition. A declaration (or "forward declaration") lets >> the compiler know that there is code for a symbol like this somewhere >> (same source file or other linked in file). Often you find them at the >> top of the source while the definition follows in the code "body" >> somewhere - and has the actual function. > > This is the basic pattern for a linked list. > It uses a recursive structure. > > The compiler consider a structure as defined after the closing brace. So > without a special artifice, a structure member can't refer to itself, > because the type has not been defined yet. > > A forward declaration is not enough to declare a variable using the type of > the struct, but it is enough to declare a pointer to it. > So this does the trick. Thanks Vincent, I missed that :) /Kåre