Re: style

From: Chris Gilbert (
Date: 03/26/00

Edward J Glamkowski wrote:
> 1.  Initializations of pointers being removed.
> In many cases, pointers, when declared, were
> immediately set to null, or zero, e.g.:
> struct obj_data *foo = 0;
> The patch is removing these intializations.
> This, to me, is a Bad Thing (tm).  In fact,
> not only should they not be removed, but
> everywhere else there isn't such an init.
> during declaration, it needs to be added!
> It's just safer that way (and easier to
> debug later).

depends on the case, some may say it's an optimisation.  (but then the
compiler should pickup on that kind of thing anyway)

Safer is an interesting thought, I'd say it makes more sense to not
initialise things as it avoid things where you don't use the variable,
you'll actually get a warning.

> 2.  Return statements at the end of void
> functions are being removed.  While it is
> true they are technically not necessary,
> they make for more consistency (every other
> function that returns something has a return
> statement, and if you want to return in the
> middle of a void function you need a return
> statment) and readability (a closing brace at
> column 0 is not always guarenteed to be an end
> of function marker - some people are extremely
> sloppy in formatting their code, I've seen it
> on quite a few patches and snippets for Circle
> MUD, not to mention elsewhere).  I say ALL void
> functions should have a return statement at the
> end, and this nonsense of removing them needs to
> be stopped and reversed.

Again that's just sloppyness (that you can clean up with indent)  But it
is preference to what style you like in your code.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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