Re: style

From: George Greer (greerga@circlemud.org)
Date: 03/26/00


On Sun, 26 Mar 2000, Edward J Glamkowski wrote:

>Just because *you* guarantee the stock code won't use until it is inited
>doesn't mean someone else won't come along and modify the code such that
>they try to use before your init, only it hasn't been initialized so they
>get a garbage pointer.

They'll generally get a compiler warning anyway.  Besides, feel free to
break your code how you like, we just try to catch what we can.

>Maybe you don't care to do it in the stock code and that is fine - you
>are the final arbiter of these matters, but I'm certainly doing it for my
>own code!

And that's the beauty of it. :)

>You have returns for exiting the function in the middle of the function,
>but not at the end.  That, to me, is inconsistent - you exit the function
>in some cases by using a return statement, but not in all cases.
>Obviuosly you can't not have the returns in the middle, so the only way
>to be consistent is to have it also at the end.

I could remove the 'return' and use 'goto' but what's the difference? Is
having 'return' in the middle worse than having 'goto end_of_this_function'
and a label at the bottom?

>I also just noted in the patch the following:
>      for (zvn = atoi(value), zrn = 0; zone_table[zrn].number != zvn && zrn <= top_of_zone_table; zrn++);  <-- semicolon at end of for loop :p
>      if (zrn <= top_of_zone_table)
>        print_zone_to_buf(buf, zrn);
>
>which looks at first glance like some mis- indented, i.e. broken, code.
>If you have a blank for loop, you really should comment it, so nobody
>reports it later as a bug :p

One would hope they'd notice the indenting, but yes, generally a coment is
good.  It probably should have one.

>But, I admit I am just nitpicking on all presented issues here, so please
>don't hate me =)

My voodoo doll isn't done yet... :)

--
George Greer            | Shirak's CircleMUD for Windows help
greerga@circlemud.org   | http://shirak.circlemud.net/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT