Re: [cc65] const/volatile

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-01-27 20:19:35


Hi!

On Mon, Jan 20, 2003 at 10:06:53AM +0100, Spiro Trikaliotis wrote:
> func1(x); // actual no need to save and restore
> func2(x); // accu and x (reuse)
>
> wouldn't it be possible to make it as follows, if x were declared as
> const unsigned char x = 10;
>
> this could be made to
>
>    GET(x)
>    PUSH()     ; pushes X on stack
>    PUSH()     ; pushes X again on stack
>    CALL FUNC1
>    CALL FUNC2

While this is possible, it is currently far beyond the capabilities of cc65.

> BTW: What does the standard say about aliasing?

ISO/IEC 9899:1999 (E) says in 6.7.3 (Type qualifiers):

  5 If an attempt is made to modify an object defined with a const-qualified
    type through use of an lvalue with non-const-qualified type, the behavior
    is undefined. If an attempt is made to refer to an object defined with a
    volatile-qualified type through use of an lvalue with
    non-volatile-qualified type, the behavior is undefined.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-01-27 20:19:38 CET