C-to-C + + upgrade

Source: Internet
Author: User

All variables in C + + can be defined when they are needed.

Variables in the C language must be defined at the beginning of the scope.

Register keyword requests the compiler to store local variables in registers

Cannot get the address of register variable in C language

The address C + + compiler that can get the register variable in C + + has its own optimization method, so almost no register

In the C language, it is legal to repeatedly define multiple global variables with the same name, and C + + does not allow it.

Strengthening of the struct keyword

-A struct in the C language defines a set of variables

-Strut defined identifiers in C language are not a new type

Structs in-c++ are used to define a completely new type

The C language requires typedef to define new types of structs, and C + + is not required.

The type of claim that all identifiers in C + + must display

The default type in C is not legal in C + +

is int f () different from int f (void)?

In the C language

-int F () represents a function that returns a value of int that accepts arbitrary arguments

-F (void) indicates an parameterless function with a return value of int

In C + +

-int f () and int f (void) have the same meaning

An parameterless function that represents a return value of int

C-to-C + + upgrade

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.