RE: [cc65] assembler/C stack issue

From: Shawn Jefferson <sjefferson1shaw.ca>
Date: 2011-02-12 02:13:47
Hmm, this shouldn't have to be an issue though, should it?

The compiler/linker will know that the function returns a char and not an
int, and it shouldn't just use whatever is in A+X when promoting to int, but
rather "know" that it should stick a zero in X first. ???  Seems broken if
that is so? 

> -----Original Message-----
> From: owner-cc65@musoftware.de [mailto:owner-cc65@musoftware.de] On Behalf
> Of Oliver Schmidt
>
> As far as I know it isn't important as long as you i.e. directly
> assign the return value to an 8-bit variable. If you however use the
> return value in an expression then according to the type promotion
> rules all values in the expression are promoted to an 16-bit value.
> The compiler makes the presumtion that the promotion of function
> return values is a nop - and this presumption breaks with assembler
> functions returning arbitrary values in X...
> 
> That's at least what I made up myself - we'll see how much of it is
> left when Uz tells the truth ;-)


----------------------------------------------------------------------
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 Feb 12 02:14:03 2011

This archive was generated by hypermail 2.1.8 : 2011-02-12 02:14:05 CET