这个警告是否正确 - "#368-D:< entity>不定义构造函数来初始化以下内容:“? [英] Is this warning alright - "#368-D: <entity> defines no constructor to initialize the following:"?

查看:270
本文介绍了这个警告是否正确 - "#368-D:< entity>不定义构造函数来初始化以下内容:“?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C ++代码中,我有一个struct类型的对象的const数组。这个结构有一些const成员。

In my C++ code, I have a const array of objects of a struct type. This structure has some const members.

我的硬件编译器(GHS Multi2000)发出警告:

My hardware compiler (GHS Multi2000) throw the warning:


368-D:类定义没有构造函数来初始化以下内容:

warning#368-D: class defines no constructor to initialize the following:


我在线读这个可以忽略。这是简单的,编译器期望const成员在构造函数初始化列表中初始化。可以禁止此警告吗?

Is this warning alright? I read online that this can be ignored. It is simply that the compiler expects const members to be initialized in the constructor initialization list. Can this warning be suppressed?

推荐答案

警告是正确的,有意义。你期望这些 const 成员有什么值,没有初始值设定器?那么为什么不删除呢?

The warning is all right, and meaningful. What value do you expect these const members to have, without an initializer? So why not remove them then?

这篇关于这个警告是否正确 - "#368-D:< entity>不定义构造函数来初始化以下内容:“?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆