VLA in Assembler

Namespaces via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 17 08:14:07 PST 2014


On Wednesday, 17 December 2014 at 15:20:28 UTC, btdc wrote:
> On Wednesday, 17 December 2014 at 14:11:32 UTC, Foo wrote:
>> And it is using malloc... ;)
>> I wanted something that increases the stack pointer ESP.
>>
>> e.g.
>> ----
>> void main()
>> {
>> 	int[] arr;
>> 	int n = 42;
>> 	
>> 	writeln(arr.length);
>> 	writeln(arr.ptr);
>> 	
>> 	asm {
>> 		mov EAX, n;
>> 		mov [arr + 8], ESP;
>> 		sub [ESP], EAX;
>> 		mov [arr + 0], EAX;
>> 	}
>> 	
>> 	writeln(arr.length);
>> 	//writeln(arr[0]);
>> }
>> ----
>> but that does not work...
>
> You cant always get what you want. try more, speak less.
Very helpful. And soo friendly! ;)


More information about the Digitalmars-d-learn mailing list