Your favourite thing about C++

Pages: 123
(inspired guess by which language...)


Hmm. By Java?
C# and Java generics are almost the same, C++ is a much different beast.

What I like about C++ templates really very much is that you can parametrize them on constants, not only on types. On the other hand what I dislike about them is that they, contrary to C# and Java, tend to compile forever, and you cannot be sure their definition is ok until you use them for the first time.


closed account (S6k9GNh0)
You think it's a coincidence it's named C# with C and C++ present?

My favorite thing about C++ is the flexibility with syntax and effeciency.
Last edited on
They called it C# cause the syntax is very C/C++ like, which made it more appealing to people who already knew these languages. But saying C++ generics inspired C# ones is a bit weird considering that C# is more Java-like, and C++ isn't exactly the only or the first language that had generics either.
I am neutral on this issue but something I like C++ over Java is why can't I have an ArrayList of primitive types in Java? In C++ a vector of int, long, float is the norm but in Java I need to use class to wrap those primitive types. This is not only for syntax differences but also efficiency.

I believe C++ templates is great but Java Generics ain't that worst either.

As for the classic C++ vs Java performance, unless your applications are very focused down to milli or even micro-seconds level, Java should more than suffice for most business applications since nowadays hardware are moving so fast that software is playing catching-up.

I am relatively certain that ArrayList works with Object type nodes instead of with templates like the STL containers which is why you need a wrapper class, though I haven't used Java in ages so I am not quite certain.

I am neutral on this issue but something I like C++ over Java is why can't I have an ArrayList of primitive types in Java?


The distinction between primitive types and objects in Java is a big PITA. C# and Scala fortunately got that right. So this is not a real problem, you have to just use a different language for the JVM, noone forces you to use Java-the-language.
Last edited on
closed account (zb0S216C)
Your favourite thing about C++

For me, it's the sheer amount of functionality that C++ offers, the speed at which it operates( although this is somewhat dependant on the compiler, or is it? ), and the ability to communicate with hardware directly via inline-assembly, all in the same source file.

There's very little you cannot do with C++. C/C++ will be one the most popular programming language( s ) for many years to come.
Last edited on
Mine, without a doubt, would be the low level control, with OOP capabilities. Sure you can get it in java, but AFAIK it's not that easy on the least abstracted part of the software level.

I'm currently working on a project that compresses data in RAM. I'm writing it in C++/Assembly, because of the above statement.

(also I will scrap the project if I can't get it efficient enough to have a (near) transparent amount of performance drop.
closed account (D80DSL3A)
I'm pretty impressed with function templates right now.
I'm doing a graphing calculator. Initially the function that does the graphing took a pointer to the function to be graphed...but I have a polynomial class where the () operator is overloaded.
I templatized the graphing function and now it works with Both ( a free function pointer or the polynomial functor ).

Amazing stuff!!
closed account (1yR4jE8b)
My favorite thing about C++ is being able to have mutable or immutable objects simply by declaring them as const or not, as long as the class is properly const-correct.

I like that now that I have a solid grasp on C++, the amount of knowledge I can transfer to other languages is substantially large and makes learning new languages very easy.

I also really like Templates, and how you can also parametrize on constants as well as types and I'm really looking forward to variadic templates in C++1x. I wish they would have kept Concepts in, though.

The flexibility of programming styles (functional, imperative, oop, etc...) is also nice, even if sometimes the actual syntax involved isn't very pretty.

I also love how it is possible to write things at a very low level, but still apply a good level of encapsulation.
My favorite thing about C++ is the STL, specifically the standard containers and std::string. They make using list data and text data easy like Perl, yet I can choose the tradeoff and capabilities I want.

They make using list data and text data easy like Perl


O'rly? How come you claim a language with no builtin regular expression support or no standard parser combinator library beats Perl at text processing? You must be either joking or not knowing the power of Perl. You see, Perl has text and file processing built into the core language. Even if you throw Boost or other advanced stuff at C++, it can't be so flexible and terse. I'd say other scripting languages with rich standard libraries and abilities to build internal DSLs are much closer with text processing power to Perl than C++ is. C++ is really good at other things, but text processing is not one of them, even with Boost regex.

E.g. write an equivalent C++ STL code for doing the same (hint: it replaces all foo with bar in all the c files), and we will see how long and ugly it is:
 
perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c 

Last edited on
I said easy 'like' Perl not easier than Perl. And in this case you're also wrong on both counts: there is regex.h, and GNU bison. As for your challenge, we all know that is actually a line of shell script not Perl. And anyway my main point is not about terseness, it is about capabilities. C++ adds onto C array and string types with various capabilities which go far beyond what is possible with the conventional libc. These capabilities make a C++ deque etc. closer to a Perl list than a C pointer-to-array done with realloc and whatever, which simply has no way to insert to the front or middle without moving data manually.
These capabilities make a C++ deque


Not really, it's not any harder to implement a deque in C than it is in C++. Making it typesafe is another story, but the implementation itself isn't too different between the two.
My favorite thing about C++ is I can program games on my old PS1 of course can easily be converted to PSP. I'm may not be a good coder or expert of some sort but it's kinda nice programming game consoles at home (C/C++).

As with Java vs C++ part, I'd say that C/C++ owned Java. I like Java and I usually do my school activities in Java instead of C++. But I'd still say that C/C++ is still better until softwares like Autdodesk Maya, Max, Adobe Photoshop, etc are written in Java.
@rocketboy9000, ok, ok, theoretically you can do just whatever in C++. But important is, how easy and practical it would be. I would never, ever, replace the Perl + Bash with C++, no matter how many regexp libraries it had. Just count the time you would have to spend writing an equivalent C++ program that does just a plain simple find and replace. C++ is a clear no go for this task.


But I'd still say that C/C++ is still better until softwares like Autdodesk Maya, Max, Adobe Photoshop, etc are written in Java.


There is no such thing as one language better over another one. They have so many features that comparing them in one dimension is pointless.

Your argument only shows that C++ is used for maintaining legacy software written in C++. Well, obvious, isn't it? You'd be crazy to rewrite these in something else. This doesn't mean ANYTHING about the technical feasibility of one language over another one, especially if they were not created at the same time (Java is like over 10 years younger than C++).

Better look at what is used for starting new projects. E.g. core database system software running those social networking sites like Facebook or Twitter. Most of them run on Java.
Last edited on
There is no such thing as one language better over another one. They have so many features that comparing them in one dimension is pointless.

Alright you win, but in my opinion there is a better language over the other. How? Considering the ups and downs of a language. Let's say add a point for a positive one then subtract a point for negative feature then summing that up.

I agree that different languages have different use, and where it specialize. Just judge it like a simple talent show, have a decision LOL.

Again, that is just my opinion so you don't have to reply back :p

Alright you win, but in my opinion there is a better language over the other. How? Considering the ups and downs of a language. Let's say add a point for a positive one then subtract a point for negative feature then summing that up.


But every programmer tend to assign different weights to these ups and downs. Also, there seem to be no agreement on some features, whether they are ups or downs. For example - is pointer arithmetic a good thing? For application programmers it's not, for creators of C++ compilers it's not, but for people dealing with bare metal stuff that might be a good thing.
You could go on all day long listing positives and negatives and it's all subjective. There really is no need for a debate, if you don't like a language, don't use it.
I LYKE SEE PLUS PLUS CAUSE I'M MAKING A MMO GAME ENGINE AND IT NEEDS TO BE FAST.

thats why i'm going to a liberal arts school to take computer science courses.
Last edited on
Pages: 123