Using a freescale processor is more compatible with standard type classifiers such as const , which means that it refers to a pointer and not to the data it points to. However, since “far away data” rather than a “far pointer” would be meaningless, you would think that it does not matter, but more consistency seems to make the compiler's simpler parser.
You can use kludgey something like:
#if defined __SOME_ARCHITECTURE__ #define DECLARE_FARPTR( type, identifier ) type __far * identifier #if defined __SOME_OTHER_ARRCHITECTURE__ #define DECLARE_FARPTR( type, identifier ) type * __far identifier #else #define DECLARE_FARPTR( type, identifier ) #endif
Then your ads will look like this:
DECLARE_FARPTR( somestruct_t, foo ) ;
or in a function prototype that takes a pointer parameter:
void fn( DECLARE_FARPTR( somestruct_t, foo ) ) ;
or a function that returns a far pointer:
DECLARE_FARPTR( somestruct_t, fn( void ) ) ;
As you can see, it quickly becomes difficult to read, and a declarative macro like a function is usually best avoided.
Clifford
source share