Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    related (possibly a duplicate): C++ - Constructor or Initialize Method to Startup Commented Mar 9, 2017 at 17:26
  • I read that, and am not sure whether this would fall into duplicate territory or not. Commented Mar 9, 2017 at 17:31
  • Miško Hevery, IMO a very respectable programmer, has his own opinion about doing real work in constructors. Check his article, that might give you few guidelines. Commented Mar 9, 2017 at 20:29
  • I mentioned this in another comment on one of the responses, but I feel this is not a duplicate; what I am really trying to get at, I guess, is that file handling is something that can fail, but it seems possibly sketchy to have a constructor that can fail. Is this gut feeling correct? I suspect not, because otherwise what would be the point of RAII? Commented Mar 9, 2017 at 23:02
  • How do you run your unit tests? Do you only ever use a file to run your tests? Commented Mar 13, 2017 at 21:36