C expert programming note 6

Source: Internet
Author: User

Chapter 6 Exercise Poetry: runtime Data Structure

A. Out: it is the abbreviation form of worker er output;

A. Out is an example of UNIX thinking "there is no reason, but we do it;

Super block (Basic Data Structure in the superblock Unix File System) is uniquely identified by the following magic number

# Define ps_magic 0x011954 the birthday of the real-time digital Berkeley Fast File System;

In UNIX, segments identify the content blocks related to a binary file;

Local variables do not enter a. Out, they are created at runtime;

The stack segment has three main purposes: 1. It provides storage space for local variables declared inside the function; 2. For function calling, it stores maintenance information related to this; 3. The stack can also be used as a temporary storage area;

int main() {int i;printf("The stack top is near %p\n", &i);return 0;}

The above small test programs can find the approximate location of your system stack;

In C language, all functions are at the top of the lexical hierarchy;

The pointer loses its validity (referencing something that does not exist) and is called "Dangling Pointer )";

The only thing that can use auto is to make your statement clearer and more tidy;

The GOTO statement cannot jump out of the current function of the C language (this is also the origin of longjmp name, it can jump far, or even be transferred to the function of other files );

#include<setjmp.h>#include<stdio.h>jmp_buf buf;banana() {printf("in banana()\n");longjmp(buf, 1);printf("you'll never see this, because i longjmped");}int main() {if(setjmp(buf))printf("back in main\n");else {printf("first time through \n");banana();}return 0;}

Setjmp and longjmp mutations in C ++ are more common exception handling mechanisms such as catch and throw ";

In UNIX, the stack automatically grows when the process requires more space. Programmers can imagine that the stack is infinitely large. This is one of the many advantages of UNIX over other operating systems such as MS-DOS;

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.