[QUOTE=ZeekyHBomb;40571959]C++11:
[code]std::string myStr = std::to_string(myInt);[/code][/QUOTE]
Yes, the new standard helps in this case, but not in all.
[QUOTE=Protocol7;40571957]C# is way different. C# manages inheritance differently than C++. At a runtime level, .NET languages use the CLR, which is a virtual machine with a built in garbage collector as part of the language spec, and C# assemblies contain metadata, whereas C++ does... pretty much none of that.
They're different beasts under the hood.
And yeah I was going to say C++ 11 does a lot of great stuff but it looks like ZeekyHBomb beat me to it before I could write it up.[/QUOTE]
C# to C++ is like saw to a knife. Both very similar and very different. But if you look at it relative to, for example, a banana, they are identical.
The only thing I'm trying to say is that nobody is going to say C++ is hard because it's library is bare.
If you're a programmer that knows 2 or 3 C-like language, you definitely wouldn't call another C-like language hard. Ever. No matter what differences it brings. You might call Haskell hard though, because it differs both in syntax and philosophy.
If you did in fact call C++ hard, that means you didn't have any other experiences with a C-like language, and it's not C++ you find hard but the general imperative programming concept and perhaps the syntax. Both of which are similar if not exactly in C++ and C#.
I am learning c++ at the moment , and i love it.
oh and , alot of people told me that java was way easier , but i find it the other way around , as other say a matter of taste.
I wouldn't call learning any other language "hard" because, and it's already been stated several times, that syntax isn't the whole shabang.
[QUOTE=Dienes;40571811]-shite-[/QUOTE]
oh god std::stringstream
thats probably 5 times slower than sprintf
[QUOTE=Tobba;40572954]oh god std::stringstream
thats probably 5 times slower than sprintf[/QUOTE]
Don't pluck random figures out of your ass, the difference in speed of streams compared to the printf equivalent is not likely to be noticeable in day to day usage.
[QUOTE=Tobba;40572954]oh god std::stringstream
thats probably 5 times slower than sprintf[/QUOTE]
Right. Now what? It's still the intended "C++ way" of formatting strings. I use it when I can, I switch to sprintf() when I must.
[QUOTE=MakeR;40573020]Don't pluck random figures out of your ass, the difference in speed of streams compared to the printf equivalent is not likely to be noticeable in day to day usage.[/QUOTE]
Well, it is indeed quite slow in comparison. At work I was able speed up some application by 33% just by replacing stringstream with sprintf (that app has execution times of several minutes to hours).
[QUOTE=MakeR;40573020]Don't pluck random figures out of your ass, the difference in speed of streams compared to the printf equivalent is not likely to be noticeable in day to day usage.[/QUOTE]
If you use it heavily, it'll be noticeable
Though if you care about performance you probably shouldent even go near the C++ standard lib, although with the later VC++ runtimes its improved to not grind everything to a halt
What do you need to print out so fast that performance matters?
The app I was talking about converts custom data files (lots of them, with up to over 1GB of data per file) to SQLite database files. The process involves a lot of string manipulation, conversion and formatting. I did some profiling and it turned out that most time was wasted (apart from the SQLite insertion) in the toString() implementation, which used std::stringstream.
Java. It is easier than c++ and there are a lots of libraries.
Sorry, you need to Log In to post a reply to this thread.