Re: [cc65] trust void func(void){} beeing empty

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2013-02-14 17:48:43
On Thu, Feb 14, 2013 at 08:17:22AM +0100, Stefan wrote:
> Is a function
>
> void func(void){} always empty?
>
> Does void func(void){asm ("Instr1"); asm ("Instr1");} contain always only the assembler code?

No, it does currently depending on compiler switches.

> Will that change in future, maybe?

Yes, maybe.

Regarding the whole question: Sorry, but there is no guarantee that all future
versions will generate the same code. It would be rather stupid by me to make
such a promise.

> For now, i define them in a seperate .s file and export the start and
> endaddress of the piece of code. With using the c inline assembler i would
> have the advantage of simply beeing able to use sizeof(func) and i can also
> declare a union with a function pointer to the piece of code and a struct
> resembling the opcodes and the operands.

The only portable solution within C is to store the code in a char array.

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 Thu Feb 14 17:48:50 2013

This archive was generated by hypermail 2.1.8 : 2013-02-14 17:48:54 CET