C99 the stack of syntax to open up memory

Source: Internet
Author: User

It is most common to open up memory on stacks in C/s + +, and as long as the memory on the stack is fixed, and C99 is a very wonderful use.

int *p = ((int[]) {[01, [Ten }];

To allocate such a space on the stack, its disassembly results are as follows:

1     int*p = ((int[]){ [0] =1, [ the] =Ten });200053f18 mov dword ptr [$S 1],1  300053F1F mov dword ptr [ebp-50h],0  400053F26 mov dword ptr [EBP-4CH],0  500053F2D mov dword ptr [ebp-48h],0  600053F34 mov dword ptr [ebp-44h],0  700053F3B mov dword ptr [ebp-40h],0  800053f42 mov dword ptr [EBP-3CH],0  900053F49 mov dword ptr [ebp-38h],0  Ten00053F50 mov dword ptr [ebp-34h],0   One00053F57 mov dword ptr [ebp-30h],0   A00053F5E mov dword ptr [EBP-2CH],0   -00053F65 mov dword ptr [ebp-28h],0   -00053F6C mov dword ptr [ebp-24h],0   the00053F73 mov dword ptr [ebp-20h],0   -00053F7A mov dword ptr [ebp-1ch],0   -00053F81 mov dword ptr [ebp-18h],0ah - 00053f88 Lea eax,[$S 1] +00053F8B mov dword ptr [P],eax

This is also open on the stack so need to specify, fixed size, also need to specify.


C99 the stack of syntax to open up memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.