问题
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