[epiar-devel] CodingConventionProposal Updated, Still in Proposal

Chris Walton chris.r.walton at gmail.com
Sat Dec 26 02:42:25 PST 2009


Cool, some thoughts:

Some compilers will produce warnings when you use 3. instead of 3.f or 3.0f
with a float. Of course, you can always disable those warnings, but we
should strive to have the compiler generate as little warnings as possible.
The Microsoft compiler emits this warning by default, and I think the
Metrowerks compiler does too.

I'd also like to propose formatting variable declarations and blocks of
assignments. While indentation should be done with tabs, formatting should
be done with spaces so that it's tab-size independent.

// bad
Sprite* sprite = NULL;
int i = 0;
std::list<Sprite*> sprites;

a->numItems = 0;
a->next = nextItem;
a->caption = strdup(blah);

// good
Sprite*            sprite  = NULL;
int                i       = 0;
std::list<Sprite*> sprites;

a->numItems = 0;
a->next     = nextItem;
a->caption  = strdup(blah);

Another thing - most of the code in Epiar follows the "braces need personal
space" model, where it's ( ( blah + 5 ) * 7 ) instead of ((blah + 5) * 7).
That should probably go into the conventions as well.

-- Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://epiar.net/pipermail/epiar-devel/attachments/20091226/c01dd03a/attachment.html 


More information about the epiar-devel mailing list