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

Rockbox mail archive

Subject: Re: Writing code for Rockbox

Re: Writing code for Rockbox

From: Daniel Stenberg <>
Date: Tue, 28 Jan 2003 08:41:47 +0100 (CET)

On Tue, 28 Jan 2003 wrote:

> What are the sizes of the fundamental types (short, int, long, etc.)?

The "standard" 32-bit ones:

 short - 16 bits
 int/long - 32 bits

> How are floating point types handled? Is floating point emulated? Roughly,
> how inefficient is it?

We avoid floats like the plague. Everything float needs to be emulated and
thus we get a lot of extra chunks of code in the image the second we start
using floats. IMHO, we have no need for floats.

> Are you writing under the C89 or C99 language Standard?

We only build with gcc, so we've taken the freedom to use some gcc-extensions
but otherwise we're mostly C89-compliant I think.

> but docs/API states that malloc and free are available. I'm a bit confused.

They *could* be available, but they are not. We have decided we don't need

> How much stack (automatic variable) space is available? How much can any
> one function "politely" use?

Default stack size is 0x400 per thread, but it differs slightly. Try the
debug menu to see stack usage stats.

> > Write normal C code. Don't redefine the language. No new types (structs
> > are structs, not typedefs)
> Does this mean that using typedef at all is deprecated? (I find typedef in
> common/*, but not in apps/*.)

Nah, not deprecated, just wisely suggested to keep at a minimum.

> Can I assume that underscores are ok in variable names and in #defines?
> (I've noticed underscores in the code.)

Yes they are. In general, just follow how things are written already and
you'll be fine.

> Also, I don't want to be argumentative, and I apologize if it's a sore
> point, but why the ban on "const"?

If you come up with a good use of const, please use it.

> Finally, I've never written code for embedded or small memory systems, and
> I'm much more of a C++ coder than a C coder. Any tips you can offer on
> either of these points, or any other obvious questions I should be asking?

Yes: have fun! ;-)

 Daniel Stenberg -- --
Received on 2003-01-28

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