The Windows Mobile platform differs greatly from maemo, especially when the .NET Compact Framework is used as a basis for software development. The maemo platform gives the developer more freedom to directly access the available resources, but it also requires the developer to take more responsibility, for example, on memory management. The maemo platform does not enforce any specific design patterns, so the developer is responsible for preventing memory leaks, buffer overflows, and other security problems.
Software for the maemo platform is mostly written in C, while the .NET Compact Framework supports using managed code. There are, however, several C++ bindings available for different libraries in the maemo platform, enabling an object-oriented approach. Despite of these bindings, C library calls must be made in code written for the maemo platform sooner or later.
Programs written with .NET CF are compiled into Common Intermediate Language, CIL. This intermediate language is run with Common Language Runtime (CLR), which appears like a runtime interpreter. When run, the code actually goes through just-in-time (JIT) compilation, which in turn provides better performance. In theory, a .NET CF software can be written in any language as long as a CIL compiler exists, but in practice C#, a programming language resembling Delphi and Java in many ways, is the most commonly used language alongside Visual Basic's .NET variation. This document discusses the issues from a C# point of view, thus some differences are possible if another programming language is used for .NET CF development.GLib is a cross-platform software utility and object management library. It enables object-oriented programming in C, without C++.
GLib defines many data structures and related operations. Developers may write such structures and operations.
GLib is mentioned here because some of its features are accessible only through C APIs.
Maemo and code written with .NET CF cannot really be compared because there are many fundamental differences. The following list is a collection of only the most major discrepancies which the developer must understand.
All code written on the .NET CF is managed, which essentially means that Common Language Runtime handles some common error situations. CLR assures that managed code supports strong type-safety while it cannot have bad pointers or create memory leaks. A maemo developer must handle these him/herself.
Unlike C/C++, C# does not support using:
The C# boolean type bool is strict and therefore cannot be converted into integer.
While C# code is managed and usually the CLR does all the work concerning pointers, it is possible to use pointers inside specific unsafe code blocks. See Unsafe Code and Pointers (C# Programming Guide) for more information.
Memory management is done automatically by CLR and therefore it cannot be manually freed due to the garbage collection which also handles possible memory leaks. For a very through explanation of how the .NET memory management works, see Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework and Garbage Collection—Part 2: Automatic Memory Management in the Microsoft .NET Framework.
.
Multiple inheritance is not properly supported in C#, but there are no restrictions on using multiple interfaces. The official answer for the lack of this feature is given in C# Frequently Asked Questions.
C# is more type safe than C/C++. The safe implicit conversions are enforced at both CIL and JIT compilation and at runtime. For a good article about .NET type safety, see article .NET Type Safety.
In C# properties, or more specifically accessors, are used to access and modify objects. Properties enable more control over member access and data validation resembling the member field access of C++.