Isblank compilation warning

Source: Internet
Author: User

Recently, the compilation warning has been cleared for previously written code, but an isblank warning has never been cleared.

 

The example source code is as follows:

 

# Include <stdio. h> <br/> # include <ctype. h> <br/> int main () <br/> {<br/> char a = 'a'; <br/> printf ("% d/N ", isblank (a); <br/> printf ("% d/N", isalpha (a); <br/> return 0; <br/>} 

 

Compilation result:

 

Bash-2.05b # gcc-wall test. c
Test. C: In function 'main ':
Test. C: 9: Warning: Implicit declaration of function 'isblank'

 

This warning indicates that isblank does not have the corresponding function declaration and must contain the corresponding header file.

Man isblank shows that the header file is ctype. h, but it still does not work.

 

 

Later, it was found that this warning was not reported during compilation in a newer Linux release, only in older versions.

Then I took a closer look at man isblank and caught a glimpse of a piece of information in man's information by chance:

Isascii ():

_ Bsd_source | _ svid_source | _ xopen_source

Isblank ():
_ Xopen_source> = 600 | _ isoc99_source | _ posix_c_source> = 2001_l;
Or CC-STD = c99

 

As you can see, isblank belongs to the c99 standard and can be proved by viewing ctype. h:

/* ISO c99 introduced one new function. */<br/> # ifdef _ use_isoc99 <br/>__ begin_namespace_c99 <br/>__ exctype (isblank); <br/>__ end_namespace_c99 <br/> # endif 

 

Add the compilation option-STD = c99 and re-compile it. The warning is finally cleared:

Bash-2.05b # gcc-wall-STD = c99 test. c

 

 

Although the compilation warning has been solved, is there a doubt that GCC does not fully support the c99 standard? I will study it later.

 

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.