Is this warning alright - “#368-D: define

2019-09-12 08:44发布

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

My hardware compiler (GHS Multi2000) throw the warning:

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

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?

1条回答
▲ chillily
2楼-- · 2019-09-12 09:24

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?

查看更多
登录 后发表回答