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

I don't know why anyone would think C++ is dead. If you need top-notch performance, there's often no reasonable alternative.



stupid question: why do people prefer C++ over C? is C considered dead?


The furniture in C++ seems better, or at least more numerous - boost, std::, Qt.. . This being said, if you make your own furniture, I still rather like 'C' better for that.

'C' is used in kernels, drivers and such, in tools and in embedded work.


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.


I don't think anyone agrees one which C++ features are worthwhile, but I think most people end up missing some feature of C++ when they fall back on C.


1) Resource management: you never have again to risk forgetting a call to "delete/free".

2) Templates: you don't need to resort to a horrible macro mess to implement a type-safe container.

3) Polymorphism: you don't need to manually manage vtables.


I would add namespaces to your list. They're extremely useful to organize entities of a program. No more prefixes to functions and types names.

Also enum classes are pretty useful. Unlike old enums, the labels do not pollute an outer scope.




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

Search: