Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2001:
[Freeciv-Dev] Re: (offtopic) C subscripts; was Re: Compiler-warnings
Home

[Freeciv-Dev] Re: (offtopic) C subscripts; was Re: Compiler-warnings

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gaute B Strokkenes <gs234@xxxxxxxxx>
Cc: Reinier Post <rp@xxxxxxxxxx>, Dirk Stoecker <stoecker@xxxxxxxxxxxxxx>, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: (offtopic) C subscripts; was Re: Compiler-warnings
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 Jan 2001 16:14:30 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxxxx

On Sat, Jan 27, 2001 at 02:35:11PM +0000, Gaute B Strokkenes wrote:
> On Fri, 26 Jan 2001, rp@xxxxxxxxxx wrote:
> 
> >> So lets take another example. On Amiga there are some structures,
> >> which have negative offset fields. And I still prefer to access
> >> them *(seglist-1) instead of seglist[-1] :-)
> > 
> > Wow, I didn't know structures with negative offsets were actually
> > used by *design*.
> 
> Backwards compatibility.  They couldn't make the struct any larger at

Wrong. An Amiga library could be accessed by base address (always in
a6 and like C++'s this). Above the base address is a general struct
which contains version, number entries, open count and so on. Above
the general struct are fields which are private to the library. At
addresses below the base address are jump entries. It is basically an
address table (like C++'s vtable). The first entries were predefined
and used to permit the library to execute code on open(), close().

IMHO the designer had done a very good job. It is a clean and
expandable interface. So you have the same OOP like you have today in
a linux kernel. However the linux kernel is in C and the Amiga can be
programmed (quite easy) in assembler.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "USENET is *not* the non-clickable part of WWW!"



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