War*_*tin 13 c++ compiler-construction struct warnings typedef
我的代码中通过相同的声明多次触发此警告,其内容如下:
// Spreadsheet structure
typedef struct SPREADSHEET
{
int ID; // ID of the spreadsheet
UINT nLines; // Number of lines
void CopyFrom(const SPREADSHEET* src)
{
ID = src->ID;
nLines = src->nLines;
}
};
Run Code Online (Sandbox Code Playgroud)
我不想只是关掉那个警告,
而是更改代码,以便警告不会出现!
注意:我不想在这里声明任何变量(它是一个头文件),只定义结构'SPREADSHEET'应包含的内容......
只需删除“ typedef”即可。您声明了一个新的结构,并且typedef没有为此使用关键字。您将用来typedef为现有类型定义新名称,如下所示:
typedef int number;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30250 次 |
| 最近记录: |