Share via


C6388

경고 C6388: <argument>이(가) <value>이(가) 아닐 수 있습니다. 이 경우 <function name> 함수의 사양과 일치하지 않습니다. 줄: x, y

이 경고는 지정된 컨텍스트에 예기치 않은 값이 사용되고 있음을 나타냅니다. 이 경고는 일반적으로 특정 값을 해당 값이 사용되지 않는 함수에 인수로 전달할 경우 보고됩니다.

예제

다음 C++ 코드에서는 DoSomething에 null 값이 필요하지만 잠재적으로 null이 아닌 값이 전달될 수 있기 때문에 이 경고가 생성됩니다.

#include <string.h>
#include <malloc.h>
#include <codeanalysis\sourceannotations.h>
using namespace vc_attributes;

void DoSomething( [Pre( Null=Yes )] void* pReserved );
 
void f()
{
    void* p = malloc( 10 );
    DoSomething( p );  // C6388
    // code...
    free(p);
}

이 경고를 해결하려면 다음 샘플 코드를 사용합니다.

#include <string.h>
#include <malloc.h>
#include <codeanalysis\sourceannotations.h>
using namespace vc_attributes;

void DoSomething( [Pre( Null=Yes )] void* pReserved );

void f()
{
  void* p = malloc( 10 );
  if (!p)
  {
    DoSomething( p );  
  }
  else
  {
    // code...
    free(p);
  }
} 

참고 항목

개념

주석 개요