Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not sure why this was posted. It's aged terribly and I think we can all agree that sidestepping constructors for init functions is basically C++ without the ++. Not sure how that's any different from writing in C.


We used init functions at my last job and got to enjoy a lot of the other benefits of C++. Lambdas, templates, std::variant, the STL, the list goes on.

Not wanting to use feature X of C++ doesn’t make it a shittier C.


I agree with you, GP is wrong about the "generally". We did use the isValid variant (and the odd factory once in a blue moon) at $former_job, no exceptions but a lot of other very nice things about C++ (as they became available).

But the article is a decade old, the project started 2007. So there is a good chance the project couldn't even use c++11 features. I still recall using initializer lists on my Linux machine only to have the nightly Windows builds fail (we were stuck on an old msvc for a while; the day we upgraded it there was much rejoice).

//Some light editing


> We used init functions at my last job

has the factory pattern somehow managed to crawl into a hole?


init functions and factory pattern are not orthogonal.


that is not the statement. they say C++ sucks because init pattern means an unititialized object might be used. the factory pattern solves that


I'm guessing it got posted because another posting had a link to it... or at least that's why I ran into this for the second time today.

I was just contemplating C vs. C++ today. I've been doing Go for some time and I want to build something relatively small and performant. I think I'll keep some C++ for myself here.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: