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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: (offtopic) C subscripts; was Re: Compiler-warnings
From: Dirk Stoecker <stoecker@xxxxxxxxxxxxxx>
Date: Fri, 26 Jan 2001 07:16:44 +0100 (MET)

On Thu, 25 Jan 2001, Reinier Post wrote:

> > This is required often, when doing pointer arithmetics and accessing
> > fields, which have already been processd (e.g. when using *(p++)) and
> > for any reason needing it again.
> > 
> > But I prefer to use *(p-1) instead of p[-1], as this is much better style.
> 
> I'm no better programmer than you are, but I don't think mixing pointers
> and subscripts is good style at all.

A matter of personal style I think. But usually I don't mix them up as
well.

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] :-)

Ciao
 ____  _ _  ____  _ _    _ _  ____
|    |  |  |    |  | \  / |  |    | the cool Gremlin from Bischofswerda
|  __   |   ____|  |  \/  |  |    | WWW: http://home.pages.de/~stoecker/
|    |  |  |       |      |  |    | PGP key available on www page.
|____| _|_ |____| _|_    _|_ |____| I hope AMIGA never ends to make fun!




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