National Instruments 320685D-01 ユーザーズマニュアル

ページ / 211
Chapter 1
LabWindows/CVI Compiler
LabWindows/CVI Programmer Reference Manual
1-14
©
 National Instruments Corporation
These two pragmas enable and disable run-time checking for a particular library function 
throughout the module in which they appear. You can use them to override the effects of the 
EnableLibraryRuntimeChecking
 and 
DisableLibraryRuntimeChecking
 pragmas 
for individual functions. If both of these pragmas occur in a module for the same function, 
LabWindows/CVI uses only the last occurrence.
Note
These pragmas affect all protection, including run-time checking of function 
arguments, for all calls to a specific library function. To disable breaking on 
errors for a particular call to a library function, use the Utility Library function 
SetBreakOnLibraryErrors
. To disable the run-time checking of argument 
expressions for a particular call to a library function, use the Utility Library 
function 
SetBreakOnProtectionErrors
.
Note
You cannot use pragmas to disable protection for the functions in the 
statically linked libraries including User Interface, RS-232, TCP, DDE, 
Formatting and I/O, Utility, X Property, and ANSI C libraries unless you place the 
DisableLibraryRuntimeChecking
 pragma at the top of the library header file. 
Details of User Protection
Pointer Casting
A cast expression consists of a left parenthesis, a type name, a right parenthesis, and an 
operand expression. The cast causes the compiler to convert the operand value to the type that 
appears within the parenthesis. 
C programmers occasionally have to cast a pointer to one data type to a pointer to another data 
type. Because LabWindows/CVI does not restructure the user protection information for each 
cast expression, certain types of cast expressions implicitly disable run-time checking for the 
pointer value. In particular, casting a pointer expression to the following types disables 
run-time checking on the resulting value: 
Pointer to a pointer: 
(AnyType **)
 
PointerExpression
Pointer to a structure:
(struct AnyStruct *)
 
PointerExpression
 
Pointer to an array:
(AnyType (*)[])
 
PointerExpression
Any non-pointer type:
(unsigned)
 
PointerExpression
,
(int)
 
PointerExpression
, and so on
Note
An exception exists. Casts that you apply implicitly or explicitly to the 
void *
 
values you obtain from 
malloc
 or 
calloc
 do not disable user protection. 
Casting a pointer to one arithmetic type to a pointer to a different one, such as 
(int *)
(unsigned *)
(short *)
, and so on, does not affect run-time checking on the resulting 
pointer, nor does casting a pointer to a void pointer 
(void *)
.
00ProRef.book : 06chap01.fm  Page 14  Monday, March 9, 1998  3:23 PM