






































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Calling convention, Element, Implementation, Storage Class Modifiers, Initialization, Register Storage Class, Static Storage Class, Extern Storage Class, Stack are the terms you can learn in this lecture and few others as well.
Typology: Slides
1 / 46
This page cannot be seen from the preview
Don't miss anything!







































This is the default calling convention for C programs. Because the stack is cleaned up by the caller. The __cdecl calling convention creates larger executables than __stdcall, because it requires each function call to include stack cleanup code.
The following list shows the implementation of this calling convention.
Element Implementation Argument-passing orderRight to left Stack-maintenance responsibility
Calling function pops the arguments from the stack Name-decoration convention Underscore character (_) is prefixed to names Case-translation convention No case translation performed
The __stdcall calling convention is used to call Win32 API functions. The callee cleans the stack.
Element Implementation Argument-passing order Right to left
Argument-passing convention By value, unless a pointer or reference type is passed. Stack-maintenance responsibility Called function pops its own arguments from the stack
The following list shows the implementation of this calling convention.
#define WINAPI __stdcall
_// Example of the _stdcall keyword
The callee cleans the stack.
Argument-passing order: Right to left
The auto storage class specifier lets you define a variable with automatic storage; its use and storage is restricted to the current block. The storage class keyword auto is optional in a data declaration. It is not permitted in a parameter declaration. A variable having the auto storage class specifier must be declared within a block. It cannot be used for file scope declarations.
Because automatic variables require storage only while they are actually being used, defining variables with the auto storage class can decrease the amount of memory required to run a program. However, having many large automatic objects may cause you to run out of stack space.
You can initialize any auto variable except parameters. If you do not initialize an automatic object, its value is indeterminate. If you provide an initial value, the expression representing the initial value can be any valid C expression. For structure and union members, the initial value must be a valid constant expression if an initializer list is used. The object is then set to that initial value each time the program block that contains the object's definition is entered.
Initialization You can initialize any register object except parameters. If you do not initialize an automatic object, its value is indeterminate. If you provide an initial value, the expression representing the initial value can be any valid C expression. For structure and union members, the initial value must be a valid constant expression if an initializer list is used. The object is then set to that initial value each time the program block that contains the object's definition is entered.