Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Default constructor & faulty warning
Default constructor & faulty warning [message #1746755] Fri, 04 November 2016 05:30 Go to next message
Eclipse UserFriend
Hello,

If I have a class with some members, and a constructor which doesn't initialize some members, I get a warning in the GUI. Good.

But if I add to the constructor = default, I should have to initialize the members.
But I still get the warning.
Re: Default constructor & faulty warning [message #1750104 is a reply to message #1746755] Fri, 16 December 2016 02:50 Go to previous message
Eclipse UserFriend
Your class probably has data members of built-in type.

Data members of built-in type remain uninitialized with a "= default" constructor, so the warning remains appropriate. In this case, a good way to avoid the warning is to give those members a default member initializer. For example:

  struct S {
      int i = 0;
   
      S() = default;  // no warning
  };
Previous Topic:ECLIPSE (CDT) Mars.1 cannot generate a proper project environment PATH for MINGW or CYGWIN
Next Topic:My title - a not very intelligent newbie.
Goto Forum:
  


Current Time: Wed Jul 16 18:03:45 EDT 2025

Powered by FUDForum. Page generated in 0.28479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top