Error c4430:missing type Specifier-int assumed. Note:c++ does not support Default-int

Source: Internet
Author: User

A strange error has recently been found with the following error message:

Error c4430:missing type Specifier-int assumed. Note:c++ does not support Default-int

The source of the error (a company's technical test) is as follows:
#include <iostream>using namespace Std;main () {Long x=65530;long countx=0;while (x) {countx++;x=x& (x-1);} Cout<<countx<<endl;return Countx;}
Post-compilation errors such as prompt:


Here's how to do this: add/wd4430 to Command Line, C + +, Additional options, Configuration properties, properties, such as:


But what? Although the problem is solved, I also "know it does not know the reason why", if the master can be seen after the cause of the problem, but the personal guess and the compiler, only for reference, the reason for this speculation is the following paragraph code:

#include <iostream>using namespace Std;main () {int x=65302250;int countx=0;while (x) {countx++;x=x& (x-1);} Cout<<countx<<endl;return Countx;}

No problem after compiling!!!

can see that

int x=65302250;

No prompt error Oh ~ ~ ~

We know that the size of int is two bytes, i.e. -32768~32767, which is obviously out of range.

The rest is handed to the martial arts ~~~~~~~.



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Error c4430:missing type Specifier-int assumed. Note:c++ does not support Default-int

Related Article

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.