Re: [cc65] ca65: .sizeof() doesn't return correct values?

From: Yutaka Amanai <>
Date: 2011-05-08 20:00:38
2011/05/09 1:55 Stefan Wessels wrote:
> Hi,
> On 2011-05-08, at 8:56 AM, Yutaka Amanai wrote:
>> 2011/05/09 0:31 Groepaz wrote:
>>> On Sonntag 08 Mai 2011, you wrote:
>>>> According to this listing, .sizeof(FOO)=2 and .sizeof(BAR)=0. And, if
>>>> you uncomment the line "lda BAZ,x", ca65 causes an error: "Size of `BAZ'
>>>> is unknown". Is this intended behavior? Or am I making a wrong use of
>>>> .sizeof() ?
>>> what exactly do you expect the size of a label to be? IMHO the (correct)
>>> result is always 2, for c64 at least :)
>> I always expect 2 (about FOO, BAR, and BAZ). I understand that .sizeof()
>> should be independent of newlines.
> The documentation for .sizeof says newlines do matter:
> "...this is the size of the data declared on the same source line as the label"
> I think what you want is simply: lda     #BAR-FOO
> Stefan

The documentation says:

     P:      .tag    Point           ; Declare a point
     will have the value 4, this is the size of the data declared on the 
same source line as the label P, which is in the same segment that P is 
relative to.

Hmm... I have thought this sentence doesn't mean the target of .sizeof() 
is limited to the data defined on the same line as labels, because it is 
not true for procedure labels. But it seems I misread. Thank you.

But if this behavior is valid, I think it is troublesome to write data 
on a line if the data is large. And, your "#BAR-FOO" method certainly 
works, but generally "FOO" is not always relevant to "BAR", so it is 
annoying that I have to be concerned with "BAR" when I want only to get 
the size of "FOO". Is there a good way to get the size of large data 
written on multiple lines?
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun May 8 20:00:50 2011

This archive was generated by hypermail 2.1.8 : 2011-05-08 20:00:54 CEST