Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Consider using
function_name_1
instead offunction_name_2
. Reason: reason
This warning occurs when you use a function that is semantically equivalent to an alternative, preferred function call.
C28159 is a general warning message; the annotation __drv_preferredFunction
was used (possibly with a conditional __drv_when
() annotation) to flag a bad coding practice.
Code analysis name: USE_OTHER_FUNCTION
The following code example generates this warning. This issue is due to the use of OemToChar
, which doesn't validate the buffer size:
char buff[MAX_PATH];
OemToChar(buff, input); // If strlen(input) > MAX_PATH, this call leads to buffer overrun
The following code example avoids this warning by using the recommended alternative OemToCharBuff
, which takes in the destination buffer size and limits the copy appropriately:
char buff[MAX_PATH];
OemToCharBuff(buff, input, MAX_PATH);
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in