[GRASS5] New MacOS X compilation errors
Justin Hickey
jhickey at hpcc.nectec.or.th
Mon Nov 13 02:05:13 EST 2000
Hi Eric
"Eric G . Miller" wrote:
> On Mon, Nov 13, 2000 at 09:53:12AM +0700, Justin Hickey wrote:
> > 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".
It dates back to Kernighan and Ritchie's "The C Programming Language"
where you'll find the following at the end of the section on switch:
"As a matter of good form, put a break after the last case (the default
here) even though it's logically unnecessary. Some day when another case
gets added at the end, this bit of defensive programming will save you."
I guess that the default case does not have to be the last case in the
switch. Strange I know, but I have actually seen code like this.
> I've seen alot of GRASS code that doesn't even have a default: in the
> switch.
I don't think any of us would say that Grass code was an example of good
programming practice :-). I've seen some pretty strange code in there.
Anyway, I think you're right that the error was due to previous errors.
I was only trying to figure out why the compiler was detecting that
error.
--
Sincerely,
Jazzman (a.k.a. Justin Hickey) e-mail: jhickey at hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand
==================================================================
People who think they know everything are very irritating to those
of us who do. ---Anonymous
Jazz and Trek Rule!!!
==================================================================
----------------------------------------
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