dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: RE: Coding conventions

RE: Coding conventions

From: Nielsen Linus (ext) <"Nielsen>
Date: Thu, 29 Aug 2002 11:14:00 +0200

> if (arghCollision(headx, heady) >= 0)
> to
> if (arghCollision(headx, heady))

OUCH! That was bad!

> I still don't know what "c++ism and Javaisms" are but I assume
> that just means I should avoid typedefs.

Hehe. Those -isms are more than that. They are usually seen as attempts to
overdo simple tasks by trying to do it according to some guru's book. They
are also seen as using veryLongIdentifiersForSimpleVariables. :-)

> Also I was told that global variables should be static. I have no
> problem to obey that rule without understanding it. But
> surely there's some background. Might it be that those global
> variables would use up stack memory if not declared static?

No, it's more about trying to avoid name collisions, and to not export
anything that doesn't need exporting. That makes the code easier to
The 'static' keyword in a global scope in C means 'don't export the symbol',
as opposed to 'don't store it on the stack' in a local scope.

> Maybe I should learn c before writing code with it...

You're doing fine.

Received on 2002-08-29

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy