Is this warning alright - “#368-D: <entity> defines no constructor to initialize the following:”?

一曲冷凌霜 提交于 2019-12-11 23:21:07

问题


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:


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?



来源:https://stackoverflow.com/questions/15126171/is-this-warning-alright-368-d-entity-defines-no-constructor-to-initialize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!