NASPRO - The 'NASPRO Architecture for Sound PROcessing'

User login

Who's online

There are currently 0 users and 0 guests online.

Syndicate

Syndicate content

Valid XHTML 1.0 Strict
Valid CSS
Viewable with Any Browser

Portability and C issues

Macros

Some macros we already mentioned in the Coding Style section, are declared to solve some little yet important portability and language-related issues.

More precisely, we have the couple NACORE_BEGIN_C_DECLS and NACORE_END_C_DECLS to avoid namespace pollution when including public headers from C++ sources, while NACORE_PUBLIC_*() and NACORE_PRIVATE_*() macros are there to solve symbol visibility issues with different compilers/OSes.

Data types

Booleans

The current situation for boolean values in C is terrible. The C89 standard does not define booleans, a lot of libraries have their own, often incompatible, definitions, and the C99 standard has the bool type.

In order to be as compatible and less confusing as possible, a nacore_bool type is defined (as an unsigned char) but no TRUE and FALSE values are declared (0 and non-0 have to be used, TRUE and FALSE values of other libraries should work as well).

Being 8 bits wide, programmers should be careful when casting to this type, but since that would be a bug even having booleans defined as ints, it is just more likely to catch it sooner (probabilistically).

Strings

All strings handled by the library are supposed to be null-terminated and in UTF-8 encoding, unless otherwise stated.

Copyright © 2007, 2008 Stefano D'Angelo