extended_errorcheck. NXP CodeWarrior Development Studio
Reklaam
Reklaam
extended_errorcheck
•
•
•
•
•
31.1 extended_errorcheck
Controls the issuing of warning messages for possible unintended logical errors.
Syntax
#pragma extended_errorcheck on | off | reset
Remarks
If you enable this pragma, the compiler generates a warning message (not an error) if it encounters some common programming errors:
It also issues a warning message when it encounters a delete operator for a class or structure that has not been defined yet. The listing below shows an example.
Listing 31-1. Attempting to delete an undefined structure
#pragma extended_errorcheck on struct X; int func(X *xp)
{
delete xp; // Warning: deleting incomplete type X
}
• An integer or floating-point value assigned to an enum
type. The listing below shows an example.
Listing 31-2. Assigning to an Enumerated Type
enum Day { Sunday, Monday, Tuesday, Wednesday,
Thursday, Friday, Saturday } d; d = 5; /* WARNING */ d = Monday; /* OK */ d = (Day)3; /* OK */
• An empty return
statement in a function that is not declared void
. For example, a non-void function with an empty return statement, listed below, results in a warning message.
Listing 31-3. A non-void function with an empty return statement
int MyInit(void)
{
CodeWarrior Development Studio for Advanced Packet Processing Build Tools Reference Manual, Rev.
10.2, 01/2016
480 Freescale Semiconductor, Inc.
Laadi alla
Reklaam