www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - AArch64 va_arg()

reply Walter Bright <newshound2 digitalmars.com> writes:
Figuring out stdarg for the Arm.

```
#include <stdarg.h>
int square(float a, float b, ...)
{
     va_list args;
     va_start(args, b);
     int i = va_arg(args, int);
     va_end(args);
     return i;
}
```
which compiles to, I kid you not:
```

































   78:	540000ab 	b.lt	8c <square+0x8c>  // b.tstop



   88:	1400000d 	b	bc <square+0xbc>




   9c:	540000ad 	b.le	b0 <square+0xb0>



   ac:	14000004 	b	bc <square+0xbc>

   b4:	93407c20 	sxtw	x0, w1
   b8:	8b000040 	add	x0, x2, x0
   bc:	b9400000 	ldr	w0, [x0]





   cc:	d65f03c0 	ret                     // epilog
```
Feb 19
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Wednesday, 19 February 2025 at 09:11:36 UTC, Walter Bright 
wrote:
 Figuring out stdarg for the Arm.

 ```
 which compiles to, I kid you not:
 [ ... ]
this is without any optimization enabled, right?
Feb 19
parent Walter Bright <newshound2 digitalmars.com> writes:
On 2/19/2025 8:42 AM, Stefan Koch wrote:
 this is without any optimization enabled, right?
Right.
Feb 19