Yes, I have fallen for this one too!  I can second the ALWAYS turn on the
Codewarrior "Require Function Prototypes" bit.  Everybody check there
projects and tick that box!

Chris

Rick Wagner <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Having spent the better part of two days tracking down this problem I
thought I add to the collective painful lesson database.
>
> ALWAYS turn on the Codewarrior "Require Function Prototypes".  Without
this Codewarrior is going to generate screwed up code without
> any warnings at all!  I spent hours and hours trying to track down this
weird bug which only happened on OS versions 3.0 - 3.3 and
> not on any others.  When I finally found the problem, I realized that it
was all due to the "Require Function Prototypes" having
> been turned off.
>
> This is how.  In one source file I had a routine, CreateRecord(DBRecord *)
which was successfully getting called from other
> routines.  In another source file I also called this CreateRecord(DBRecord
*).  BUT, when I was moving routines around into more
> distinct source files I didn't add a global prototype for CreateRecord().
>
> Thus, in the module that didn't have the prototype it was silently
treating the CreateRecord() routine as CreateRecord(int) instead
> of the CreateRecord(long).  Then when the CreateRecord() was being called
it wasn't getting the correct parameter off the stack.
> The REALLY annoying thing is that is was always getting a 1, instead of
the 0 that was trying to be passed.  My hair is finding
> other locales fast enough without my help pulling it out.
>
> So, that's it.  I hope this helps somebody out someday.
>
> Rick Wagner
> Mindweave Software, Inc.
>
> PS: Rereading this someone might think that I'm blaming codewarrior.  Not
at all!  It was definitely  a user error (most likely
> mine).
>
> Attached below is the output.  I'm including this so that it's searchable.
>
> Here is the mixed assembler/C source from the debugger:
> err = CreateRecord(NULL);
> 00048C8A: 42A7            clr.l    -(a7)
> 00048C8C: 4EBAF37C        jsr      *-3202                  ; 0x0004800a
>
> Here is the another snippet from another area of the program:
>         case NewButton:
> if(CreateRecord(NULL) == 0) { //create new empty loan
> 00047190: 4267            clr.w    -(a7)
> 00047192: 4EBA0EB6        jsr      *+3768                  ; 0x0004804a
>
> Note that on one line this is a clr.l, and on another line it is clr.w.
>
> (these were from two different compiles so the jsr address is different).
>
>
>





-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to