#pragma warn macro directive in c _ suppress warning messages - c programming - c4learn

Upload: ashutosh-verma

Post on 10-Oct-2015

11 views

Category:

Documents


0 download

TRANSCRIPT

  • #pragma warn Macro Directive in C | Suppress WarningMessages

    Topics : How to Suppress Warning Messages in C ?

    What is Warning Message in C ?1.

    What is Error and Message in C ?2.

    #pragma warn Directive in C3.

    Live Example4.

    List of Warning Codes in ANSI5.

    Warning Message :

    A warning is a non-critical condition that does not require immediate attention.

    Warning can be ignored.

    Waring will never stop your execution of C Program.

    Error Message

    An Error is a critical condition that requires immediate attention.

    Error messages cannot be ignored.

    Compile Error wont let you to run C Program.

    run Time Error will terminate current execution of C program

    #pragma warn Macro Directive in C

    In c there are many warning messages which can be on or off with help of #pragmawarn.

    1.

    Syntax :

    #pragma warn +xxx#pragma warn xxx#pragma warn .xxx

    Where

    + means on- means off. means on/off (toggle)

    xxx is indicate particular warning code in thee alphabet.1.

    Example : rvl warning code means function should return a value.2.

    Live Example :

    #include

    Show Complete Index

    C Programming :Preprocessor

    Tasks Performed By

    Pre-processor

    File Inclusive Directives >> C

    Preprocessor Directives

    How C Processor Works |

    Processing of Preprocessor

    Directives with Flowchart

    What Pre-processor Directive

    do ? | Tasks Performed by

    Preprocessor Directive

    #define Preprocessor Directive

    in C | Simple Substitution

    Macro

    Nested Preprocessor Macro

    directive having Arguments in

    C Programming

    Macro Taking Argument in C |

    Argumented Macro

    Preprocessor inC Programming

    Difference between macro and

    function in C Programming

    #if statement

    #else statement

    #elif statement

    #ifdef statement

    #ifndef statement

    #undef

    #pragma directive in C

    #pragma startup and #pragma

    exit directive in c Programming

    Language

    Pre-processor to Define String

    in C Programming

    #pragma warn Macro Directive

    in C | Suppress Warning

    Messages

    Common C Programming

    Mistakes

    Preprocessor in C

    Programming

    200+ C Programs

    Learn C

    Learn C++

    Learn Linked List

    Java Technologies

    Learn Ant

    Learn Collection

    Learn Java

    Learn JDBC

    Learn JSP

    Learn JSTL

    Learn Servlet

    Learn Swing

    Web

    Learn Ajax

    Learn Android

    Learn AngularJS

    Learn AWK

    Learn Bootstrap

    Learn CSS

    Learn ExtJS

    Learn HTML

    Learn JavaScript

    Learn jQuery

    Learn JSON

    Learn PHP

    Learn SQL

    Learn VBScript

    Learn XML

    Learn XML DTD

    Subscribe Us

    Email

    C/C++ Java Web Development

    Previous Page Next Page

    #pragma warn Macro Directive in C | Suppress Warning Messages - C Pr... http://www.c4learn.com/c-programming/c-pragma-warn-macro-directive/

    1 of 3 8/8/2014 3:36 PM

  • #pragma warn rvlint main(){printf("It will not show any warning message");

    }

    Explanation :

    -rvl mean suppress warning message .1.

    rvl means : Function should return a value.2.

    We have specified return type of main as Integer but we are not going to return avalue.

    3.

    Usually this program will show warning message.4.

    We have suppressed warning already (-rvl) so we wont get any warning message.5.

    Standard notation and there actual meaning is shown inside following table -6.

    List of Warning Codes in C

    S.N. Warning message Code

    ANSI Violations

    1 Assigning type to enumeration eas

    2 Bit fields must be signed or unsigned int bbf

    3 Both return and return with a value used ret

    4 Declare type type prior to use in prototype dpu

    5 Division by zero zdi

    6 Hexadecimal value contains more than 3 digits big

    7 Initializing enumeration with type bei

    8 identifier is declared as both external and static ext

    9 Ill-formed pragma ill

    10 Initialization is only partially bracketed pin

    11 Redefinition of macro is not identical dup

    12 Suspicious pointer conversion sus

    13 Undefined structure structure stu

    14 Void functions may not return a value voi

    Frequent Errors

    1 Code has no effect eff

    2 Function should return a value rvl

    3 Parameter parameter is never used par

    4 Possible use of identifier before definition def

    5 Possibly incorrect assignment pia

    6 Unreachable code rch

    Less Frequent Errors

    1 Ambiguous operators need parentheses amb

    2 Array variable identifier is near ias

    3 Call to function with no prototype pro

    4 Call to function function with no prototype pro

    Recent Posts

    AngularJS Extends HTML

    AngularJS Environment : Setup

    JSTL XML choose tag

    JSTL Core tag url() : Function

    JSTL Core tag redirect() : Function

    About the Author

    Pritesh Taral is a Programmer, WebDeveloper and founder of c4learn.com, awidely-read programming site for beginners.Email: pritesh [at] c4learn.com

    #pragma warn Macro Directive in C | Suppress Warning Messages - C Pr... http://www.c4learn.com/c-programming/c-pragma-warn-macro-directive/

    2 of 3 8/8/2014 3:36 PM

  • 5 Condition is always false wccc

    6 Condition is always true wccc

    7 identifier declared but never used use

    8 identifier is assigned a value that is never used aus

    9 No declaration for function function nod

    10 Structure passed by value stv

    11 Superfluous & with function amp

    Portability Warnings

    1 Constant is long cln

    2 Constant out of range in comparison rng

    3 Conversion may lose significant digits sig

    4 Non portable pointer comparison cpt

    5 Non portable pointer conversion rpt

    6 Mixing pointers to signed and unsigned char ucp

    HOME CODE EDITOR EBOOK AUTHOR STAFF ADVERTISE 2009-2013 Programming Tutorials.The content is copyrighted to Pritesh Taral and may not be

    reproduced on other websites.

    Previous Page Next Page

    Leave a Reply

    YOUR NAME *

    YOUR EMAIL *

    YOUR WEBSITE

    Post Comment

    #pragma warn Macro Directive in C | Suppress Warning Messages - C Pr... http://www.c4learn.com/c-programming/c-pragma-warn-macro-directive/

    3 of 3 8/8/2014 3:36 PM