Here's the problem: I have a macro which is called all over a large
program, and which will produce incorrect results if the argument is
an unsigned [long] int.
(It didn't originally, but an external header file changed).
What I was trying to do was catch this, by (for test purposes)
changing the macro and forcing a compiler error or warning if used
with an unsigned long int, rather than long int. This is proving more
challenging than I expected.
I tried
#undef THEMACRO
#define THEMACRO(x) CallProc(&x)
long int CallProc ( long int *x) ;
(Which gives a few errors on things that aren't lvalues but I can live
with that).
But it seems that (in this environment) I get no error if THEMACRO is
used for an unsigned int.
The code can be compiled in Microsoft Visual C++ or Metrowerks
CodeWarrior; as C or C++ language. (Setting up to compile with another
compiler would probably take more manually checking all references,
which this lazy programmer is trying to avoid).
(Background: the macro used to do x<<16 but now does
x < -32767 ? BAD_RESULT : x << 16.
So far as I can tell the effect of feeding this an unsigned int is
that the -32767 is treated as unsigned before doing the comparison.)
Thanks in advance,
----------------------------------------
Aandi Inston qu***@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.