Microsoft KB Archive/41212

= INFO: Must Use Prototype Before Intrinsic or Function Pragmas =

Article ID: 41212

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 1.5 Professional Edition
 * Microsoft Visual C++ 1.51
 * Microsoft Visual C++ 1.52 Professional Edition
 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 2.0 Professional Edition
 * Microsoft Visual C++ 2.1
 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 5.0 Standard Edition
 * Microsoft Visual C++ 6.0 Service Pack 5

-



This article was previously published under Q41212



SUMMARY
There are a number of C Run-time routines that have both a function version and an intrinsic version. If the following statement is used in an application to force use of the function version:   #pragma function( a_CFunction ) where a_CFunction is a C Run-time library routine, the compiler generates the following error:

error C2164: 'a_CFunction': intrinsic was not declared.

if the /Oi option is not used. The same is true for the following statement to force use of the intrinsic:   #pragma intrinsic( a_CFunction ) When you don't use the /Oi or /Ox option, you need to declare a function prototype before you can use the function or intrinsic pragmas. For example, to properly use the memcpy function in the Sample Code below, either STRING.H or MEMORY.H must be included. Consult the C Run-time documentation for the appropriate header (.H) file to include.

For more information about #pragma intrinsic or C Run-time functions that have intrinsic versions, consult the documentation provided with your Microsoft compiler or development environment.

Sample Code
/* Compile options needed: none


 * 1) pragma function( memcpy )

char s1[] = &quot;string&quot;; char s2[10];

void main {  memcpy( s2, s1, 7 ); }

Additional query words: 8.00 8.00c 9.00 9.10

Keywords: kbinfo kbcode kbcompiler KB41212

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.