0
我已經運行質量分析控制我的代碼基礎,我有一個關於看到了一些錯誤值有一個疑團,如下圖所示:質量分析控制疑惑
這僅僅是一個代碼提取
typedef struct UISR_caller_info_s/*structure declaration*/
{
unsigned char number[20];
unsigned char Name[30];
unsigned int numberType;
} caller_t;
static caller_t gs_val;/*variable of the structure type*/
錯誤:
2027: strcpy((char *)gs_val.Name, NULL);
^
Msg(2:0310) Casting to different object pointer type.
REFERENCE - ISO:C90-6.3.4 Cast Operators - Semantics <next>
錯誤顯示在char * typecasting,我真的不知道爲什麼會發生這種情況。 請讓我知道如何避免這種錯誤
感謝 GNR
@Carl ...我試過這個,但是在運行QAC時我發現了同樣的錯誤,重複 – Maddy
@carl ...當我嘗試使用(void *)類型轉換時,它工作正常。不知道它是如何發生的 – Maddy
@Maddy - 如果你在'strcpy'調用中有'NULL',那麼它絕對不會*正常工作。 –