Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: "division by zero" error during compilation (PR#1954)
Home

[Freeciv-Dev] Re: "division by zero" error during compilation (PR#1954)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: "division by zero" error during compilation (PR#1954)
From: Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 8 Sep 2002 23:32:38 -0700 (PDT)

Raimar Falke wrote:
On Wed, Aug 21, 2002 at 12:16:33PM -0700, jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:

If I compile FreeCiv with gcc3 and -Werror, I get

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I./include -I../common -I../intl -I./agents -g -O3 -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Werror -g -Wall -c `test -f tilespec.c || echo './'`tilespec.c
cc1: warnings being treated as errors
tilespec.c: In function `fill_tile_sprite_array_iso':
tilespec.c:1269: warning: division by zero
tilespec.c:1271: warning: division by zero
make[3]: *** [tilespec.o] Error 1

Another suggestion: just make the code a real function. There is no
need for a macro. It isn't used often.

Sure, that would be fine too.

One thing: in the case of an invalid direction, it's good to have an assert (or alternative error checking function, as discussed elsewhere). But I don't think returning -1 or the given (invalid) direction is particularly productive - the best chance for recovery of the game would be to return an (arbitrary) valid direction.

jason




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