Re: [cc65] More on the prototype bug

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2006-03-31 22:40:16
On Fri, Mar 31, 2006 at 01:55:32PM -0500, Andrew J. Kroll wrote:
> I turned on the important debugging and captured the following data.
>
> Left : 00AE B4A8 9010 8000 8000 8000 006D 0121
> Right: 00AE B738 9010 8000 8000 8000 006D 0121
>              ^^
> Note these bits here cause the error message to apear.
>
> What are the meaning of those bits?

0x00AE means "function". The next five numbers are an encoded pointer to the
function descriptor (which explains why they are different)[1]. 0x006D means
"pointer to" and 0x0121 means "unsigned char". So both numbers translate to

        "function returning pointer to unsigned char"

The parameter list is encoded in the function descriptor.

> I've tried to go thru the include files in the source for difinitions,
> but they don't seem to be meaningful when I decode them.

The necessary bits are in datatype.h at the beginning.

> Here's the testcase again, incase anyone else wishes to see what is going
> on. Sometimes it helps to have an extra set of eyes on the bug.

Why do you insist on using K&R functions together with non K&R prototypes?
Yes, it's definitely a bug in cc65. But K&R style C has been marked as
obsolete in the C standard from 1999. It should be avoided when writing new
code. Your code won't be compatible with K&R anyway, since K&R compilers don't
understand prototypes, so I cannot see a reason for mixing the two styles.

[1] Note: This was non portable and has therefore changed in the latest
snapshot. So if you try this with the snapshot, the output will be different.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Mar 31 22:40:31 2006

This archive was generated by hypermail 2.1.8 : 2006-03-31 22:40:34 CEST