Old said:
3) Don't use your macro inside an 'if' statement:
FARPTR_INC(p);
if (p)
Yes, I've considered using that if I need it.
However, having spent more time today fiddling with macros across
various platforms I've now reached the state where there isn't a problem
any more. The only platform where I need to use this particular horrible
kludge inside an 'if' or 'while' is one that doesn't seem to issue
warnings anyway. It doesn't even issue a warning at 'if (a = b)' which
is a bit disconcerting. Good job the code is multi-platform, you sort of
get the benefits of all of the platforms put together so if I make such
a mistake and one compiler lets me away with it then one of the other
compilers won't.
IMHO, you should avoid creating objects that cross 64KB boundaries.
Oh I agree, C allocated objects never cross 64KB boundaries. But in this
case it isn't an "object" in the C sense, because the same problem
occurs on native pointer support (I use pointers to large data areas
that the compiler has no direct knowledge of).
Does the system documentation on the "extended memory architecture"
include any suggestions along these lines?
Sure.
It was one of their macros that I borrowed the cast to ULONG from
But they admit issues with 64KB boundaries for now.
An 8-bit short would not conform to the C standard.
Nor would half the other stuff I regularly have to deal with in embedded
compilers. See the fun us embedded guys have? Must be terrible only ever
being able to write strict ANSI C code ;-)
Although, seriously, I do admire the depth of knowledge encountered in
here from the C purists. Can someone give me a hyperlink to the official
C standard? It would make a good read from time to time...