At 7:24 PM -0700 1999/04/18, Mike Davis wrote:
>int TestFunction(char * ptr)
>{
> char tmpChar;
> tmpChar = *ptr; // *ptr may be NULL
>
> // always generates run-time
> if(tmpChar != ':' && tmpChar != ';') { // some code }
>
> // never generates run-time error
> if(*ptr != ':' && *ptr != ';') { // some code }
Hmmm...
Are you absolutely certain the error occurs on the first if-statement and NOT on the
tmpChar = *ptr assignment? If ptr is not valid going into the function that assignment
will fail (e.g. bus error) but depending on where ptr actually points, the debugger
might imply the wrong line number in its exception handler.
Try switching the two if-statements around (and/or removing them entirely) and run the
test again.
Also, what are your project settings? Is this a multi-segment application, a code
resource, a shared library... optimization level... etc.?
Regards,
Jim Schram
3Com/Palm Computing
Partner Engineering