Cleaned up C++

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 24 23:51:26 PDT 2015


On 25 Apr 2015 01:25, "Walter Bright via Digitalmars-d" <
digitalmars-d at puremagic.com> wrote:
>
> On 4/24/2015 5:59 AM, John Colvin wrote:
>>
>> one reason why it might be faster is that e.g. gcc can produce code like
this:
>>
>> #include<alloca.h>
>>
>> void bar(char* a);
>>
>> void foo(unsigned int n)
>> {
>>    char *a = (char*)alloca(n);
>>    bar(a);
>> }
>>
>> foo:
>>      movl    %edi, %eax
>>      pushq    %rbp
>>      addq    $46, %rax
>>      movq    %rsp, %rbp
>>      shrq    $4, %rax
>>      salq    $4, %rax
>>      subq    %rax, %rsp
>>      leaq    31(%rsp), %rdi
>>      andq    $-32, %rdi
>>      call    bar
>>      leave
>>      ret
>>
>> which is neat.
>
>
> It's a cowboy implementation that's fine until it someone tries a largish
value of n.
>

I wonder just how large...  IIRC I think the limit on ubyte arrays is 1M?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150425/bc94a98c/attachment.html>


More information about the Digitalmars-d mailing list