Главная страница | назад





Article #17011: How to use #pragma to stop a warning

 Question and Answer Database

FAQ2011C.txt   How to use #pragma to stop a warning
Category   :Command Line Tools
Platform    :All
Product    :C++Builder  1.x

Question:
How do I use a #pragma to stop the compiler from issuing a warning? 

Answer:
Here is how you would go about turning off the annoying
warning messages.  Be warned that although they are 
annoying they do serve a purpose, do not turn them 
off until you have investigated them all.

syntax:
#pragma warn -xxx //xxx is the following 3 letter code

ANSI VIOLATIONS:

Void functions may not return a value: -voi, default: ON
Both return and return of a value used: -ret, default: ON
Suspicious pointer conversion: -sus, default: ON
Undefined structure 'ident": -stu, default: ON
Redefinition of 'ident' is not identical: -dup, default: ON
Hexadecimal value more than three digits: -big, default: ON	
Bit fields must be signed or unsigned int: -bbf, default: OFF
'ident' declared as both external and static: -ext, default: ON
Declare 'ident' prior to use in prototype: -dpu, default: ON
Division by zero: -zdi, default: ON
Initializing 'ident' with 'ident': -bei, default: ON
Initialization is only partially bracketed: -pin, default: OFF
Non-ANSI keyword used: -nak, default: ON

GENERAL:

Unknown assembler instruction:a-asm, default OFF
Ill-formed pragma: -ill, default ON
Array variable 'ident' is near: -ias, default ON
Superfluous & with function: -amp, default OFF
'ident' is obsolete: -obs, default ON
Cannot create precompiled header: -pch, default	ON
User-defined warnings: -msg, default ON

INEFFICIENT C++ CODING

Functions containing 'ident' not expanded inline: -inl, default	ON
Temporary used to initialize 'ident': -lin, default ON
Temporary used for parameter 'ident': -lvc, default ON

INEFFICIENT CODING

'ident' assigned a value which is never used: -aus, default ON
Parameter 'ident' is never used: -par, default ON
'ident' declared but never used: -use, default OFF
Structure passed by value: -stv, default OFF
Unreachable code: -rch, default	ON
Code has no effect: -eff, default ON

OBSOLETE C++

Base initialization without class name is obsolete: -obi, default ON
This style of function definition is obsolete: -ofp, default ON
Overloaded prefix operator used as a postfix operator: -pre, default ON

PORTABILTY

Non-portable pointer conversion: -rpt, default ON
Non-portable pointer comparison: -cpt, default ON
Constant out of range in comparison: -rng, default ON
Constant is long: -cln, default OFF
Conversion may lose significant digits: -sig, default OFF
Mixing pointers to signed and unsigned char: -ucp, default OFF

POTENTIAL C++ ERRORS

Constant member 'ident' is not initialized: -nci, default ON
Assigning 'type' to 'enumeration': -eas, default ON
'function' hides virtual function 'function2': -hid, default ON
Non-const function  called for const object: -ncf, default ON
Base class 'ident' inaccessible because also in 'ident': -ibc, default ON
Array size for 'delete' ignored: -dsz, default ON
Use qualified name to access nested type 'ident': -nst, default ON
Handler for '' Hidden by Previous Handler for '': -hch, defautl ON
Conversion to 'type' will fail for virtual base members: -mpc, default ON
Maximum precision used for member pointer type : -mpd, default ON
Use '> >' for nested templates instead of '>>': -ntd, default ON
Non-volatile function  called for volatile object: -nvf, default ON

POTENTIAL ERRORS

Possibly incorrect assignment: -pia, default ON
Possible use of 'ident' before definition: -def, default OFF
No declaration for function 'ident': -nod, default OFF
Call to function with no prototype:a-pro, default ON
Function should return a value: -rvl, default ON
Ambiguous operators need parentheses: -amb, default OFF
Condition is always (true/false): -ccc, default ON
Continuation character \ found in //: -com, default ON



7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99