Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Writing code for Rockbox
From: rockbox_at_diffenbach.org
Date: 2003-01-28


I've downloaded the Rockbox source and given it a cursory look.

I've got a few questions that I didn't see covered in the docs I read (if I
missed a doc, please point me to it, and accept my apologies for missing
it).

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

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

Are you writing under the C89 or C99 language Standard?

in docs/TECH, under memory usage, it is written that:
Memory Usage

        ...Also, since we need to be able to do almost
  everything in Rockbox simultaneously, we use no dynamic memory allocation
  system at all. All sub-parts that needs memory must allocate their needs
  statically. This puts a great responsibility on all coders.

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

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

docs/CONTRIBUTING advises contributors to:

Language features
-----------------
Write normal C code. Don't redefine the language. No new types (structs are
structs, not typedefs), no C++isms or Javaisms. Also, avoid using "const".

Names
-----
Variables and function names should be all lower case.
Preprocessor symbols should be all uppercase.

Does this mean that using typedef at all is deprecated? (I find typedef in
common/*, but not in apps/*.)

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

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

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?

Thanks,
Tom



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa