[GRASS5] New MacOS X compilation errors

Eric G . Miller egm2 at jps.net
Sun Nov 12 22:58:06 EST 2000


On Mon, Nov 13, 2000 at 09:53:12AM +0700, Justin Hickey wrote:
> Hi Eric
> 
> "Eric G . Miller" wrote:
> > Hmm, the compiler doesn't deal with empty "default:" statements in a
> > switch properly???  Try removing the line above that has the empty
> > default statement and see if it works then.  If it does, I'll remove
> > it from the CVS version (but it's really a compiler bug).
> 
> May I suggest adding a "break;" statement as the "default:" action? The
> compiler is probably expecting a C expression (ie something that ends
> with a semicolon) and finding the "end switch" brace bracket instead.
> Besides, it is good programming practice to always include a break
> statement for the default case.

Hmm, didn't know this "break" thing was "good programming practice".
I've seen alot of GRASS code that doesn't even have a default: in the
switch.  In any case, it comes last in the switch and should be ignored
by any sensible compiler whether it has a "break" statement or not.
But, see below.
 
> And, in general, please do not remove legitimate code from the CVS
> source files. If there is a bug in a particular compiler that it cannot
> parse legitimate ANSI C code, then a FAQ should be created for that
> compiler with a work around solution. We should not change legitimate
> code in the source files for a compiler or system bug.

Yea, generally I agree with this.  I think in this case it turned out to
be an artifact of previous compilation errors.  I wouldn't generally remove
code that actually does something just to work around a particular
compiler/system bug (I'd look at #ifdef macros...).  In this case, the
"default:" just indicated there was no default (the same switch is used
earlier, so any error is caught there).

Cheers,

-- 
#! /bin/sh
# ppp-address: What's my Internet Address for ppp0 ?
/sbin/ifconfig ppp0 2> /dev/null | grep 'inet addr:' | sed \
's=.*inet addr\:\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*=\1='

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list