04-09-2013, 07:36 AM
Rule 8-5-1 (Required) "All variables shall have a defined value before they are used."
My reading of this rule leads me to the conclusion that "POD" classes are effectively not allowed, since any user-defined constructor provided to give initial values to non-static member data results in the class no longer being POD. Example:
[code]// Standard headers
#include
#include // std::is_pod
// User-defined structs...how many are POD?
struct Trivial_Ctor { int i; };
struct With_User_Defined_Ctor { int i; With_User_Defined_Ctor() { } };
struct With_Initialised_Member { int i; With_Initialised_Member() : i(0) { } };
int main()
{
std::cout
My reading of this rule leads me to the conclusion that "POD" classes are effectively not allowed, since any user-defined constructor provided to give initial values to non-static member data results in the class no longer being POD. Example:
[code]// Standard headers
#include
#include // std::is_pod
// User-defined structs...how many are POD?
struct Trivial_Ctor { int i; };
struct With_User_Defined_Ctor { int i; With_User_Defined_Ctor() { } };
struct With_Initialised_Member { int i; With_Initialised_Member() : i(0) { } };
int main()
{
std::cout
<t></t>