Re: [cc65] More on the prototype bug

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2006-04-01 13:55:52
On Sat, Apr 01, 2006 at 04:11:46AM -0500, Andrew J. Kroll wrote:
> Here is the small patch that seems to fix the bug. I hope I did the right
> thing, but it does seem to fix the problem.

Not really. Your patch considers any K&R function equal to any new style
prototype, which is not, what should happen. From ISO/IEC 9899:1999 (E),
"6.7.5.3 Function declarators (including prototypes)", paragraph 15:

    If one type has a parameter type list and the other type is
    specified by a function definition that contains a (possibly
    empty) identifier list, both shall agree in the number of
    parameters, and the type of each prototype parameter shall be
    compatible with the type that results from the application of the
    default argument promotions to the type of the corresponding
    identifier. (In the determination of type compatibility and of a
    composite type, each parameter declared with function or array
    type is taken as having the adjusted type and each parameter
    declared with qualified type is taken as having the unqualified
    version of its declared type.)

The place is right, and the change will work around the problem, but as a side
effect, it accepts invalid code. It is ok to make your code compile, but it is
not sufficient as a general solution for cc65.

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 Sat Apr 1 13:56:03 2006

This archive was generated by hypermail 2.1.8 : 2006-04-01 13:56:06 CEST