Hacker News new | past | comments | ask | show | jobs | submit login

I miss generics and RAII when I have to use C.



RAII is nice—I hope GCC's __attribute__((cleanup)) gets included in C2x.

Templates though... are nice, I guess, but the cost in compile time, ABI, code size, and ease of debugging is a lot to swallow.

Besides, with the preprocessor and M4 you can get many of the benefits of templates, albeit with most of the downsides (and a few more to boot).


well, santaclaus wrote 'generics', not 'templates'. So presumably that means containers like std::vector, or std::unordered_map. Those are pretty easy to deal with.


C gives you very very little in the way of tools to create and manage abstraction. Some programmers love this and for some projects it may be appropriate.

But is a reason so many large native codebases go with C++. The language provides some pretty handy tools to manage code organization and complexity at that scale.


from a java background is it better to jump into C++ instead of C?


Yes. Be sure to jump straight into the most modern C++ practices and avoid thinking of it like C (with all its focus on non-type-safe pointer manipulations).

Other people have other opinions, of course. Care most about the opinion of your boss and team mates. If you show up with a C++ style far beyond what they are used to they will think you are a nut.


I'm going to say no, because C++ seems closer to Java at first but it's really not. You'll probably spend too much time learning about templates and its object system instead of learning to think in the things that make C and C++ unique—pointers, pointer arithmetic, explicit handling of error conditions, low-level control of memory, preprocessor, etc.




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

Search: