I’ve been studying Java for a while and I feel really comfortable with the fact that I could get the JDK and official compiler form Sun’s page, the API is easy to check and find what I need and how to use it.
I am interested in learning C++ but I’m a little bit confused on how the Standard Library works compared to the class libraries in Java. I come to you with these questions:
-> How is the Standard Library different and how does it work?
-> What’s the difference between using one compiler instead of another.
-> What are some good compilers and IDEs you would recommend to someone that’s starting?
Thanks in advance
The answer to your first question would fill one or more books. Go buy one of those books. Besides, there is really no requirement to use the standard library in the first place, as your OS provides APIs that may or may not be better suited for your tasks, and may or may not use parts of the standard library.
The difference between compilers involves things such as quality of the generated code, the degree of standards-compliance in the language implementation and library implementation, the quality of error messages, and fancy stuff like debugging.
The standard compiler these days is pretty much gcc. If you're using Windows, get the mingw version. As for IDEs, I guess Dev-C++ might be useful, but I haven't tried it.
> How is the Standard Library different and how does it work?
Plenty of templating magic. It's also less kitchen-sink than Java's. This is a mixed blessing.
> I guess Dev-C++ might be useful, but I haven't tried it.
Dev-C++ is effectively dead. An alternative is Code::Blocks, which works fair enough.
The development practices of the Code::Blocks dev team are a bit of a joke though.
[Insert obligatory recommendation to use D instead.]
>>4
We have a winner.
C++ is showing its age, although you still need to know it if you want a job (and hate yourself).
>>4-5 Do you recommend a good book for D?
Unless you can read Japanese or German, there is none (and the Japanese one is massively out of date). All there are in English are online tutorials, a spec, and some mailing lists.
That's the real problem with D: great language, but it's so bleeding edge that the surrounding ecosystem is still small.
The best I can suggest is:
Summary: http://en.wikipedia.org/wiki/D_programming_language
Tutorials: http://www.dsource.org/projects/tutorials
General: http://www.digitalmars.com/d/index.html
Lists: http://lists.puremagic.com/
IRC: #d@irc.freenode.org
It's definitely not for the inexperienced or anyone adverse to constant change.
I am german. :D
We had a 10hr tutorial at my university but it was full when I tried to get in. And online tutorials are generally (in my experience) not as good as a well written book. :(
>>8
Cool, I'm german too... so there's at least two German /code/ peoples.
So, I wonder... where exactly in Germany are you from? I'm from somewhere Baden-Württemberg-ish... who knows, we could be neighbours for all we know! ;)
(Sorry if this is a tad offtopic. And anyways, I'm interested in what >>7 would reccomend, too)
The German book is available online: http://www.steinmole.de/d/d_buch.pdf
The formatting leaves something to be desired, but it's fairly up to date. I'd say it's targetted at coders with prior experience in other languages; novices might have a rough time.
C++ is steaming pile of crap, learning it is only ever useful to know what NOT to do in a programming languages. Compared to it, even Java is good. Learn C and Python if you don't want to move too far away, C and Python and Lisp/Haskell/Prolog if you do.
No, Java is still much, much worse. C++ may have faults but you can avoid of a lot of them by simply not using those features, and C++ is far more expressive than Java will ever be.
Java > C++
>>15 has never written a real program in his life, nor a real sentence.
Vomit > Feces
>>16
Ohh... weak troll.
You fail because:
1) Talking in absolutes.
2) Using shady, subjectiv definitions.
3) Assumptions.
Are you trying to respond to someone you call a "troll" by claiming they are not making a well-supported argument? That seems just a little bit counter-productive, no?
Not to mention your three points seem to apply equally well to >>15. That was the point - if you want to make an argument, make an argument instead of trying to be a cool kid on the internet.
>>19
14 and 15 are just posting an opinion. Both have not stated any facts. Both of them need to explain why they think so.
Whereas 16 is just a dumb troll trying to provoke 15. Next time you try to troll do it better.
Here, lemme explain for retards. (Not the OP, though it's kind of retarded to ask this kinda thing here)
C is a STANDARDIZED language. Any compiler you get comes with the STANDARD libraries + any implementation quirks.
You'd wanna use GCC. Under windows you'd get MSYS+MINGW or something.
Who are you talking to, again?
k
k
k
k
k
D seems like a really good language, but I haven't seen one thing made by an English-speaking programmer with it. The features are VERY impressive, though, especially to someone like me who programs games (some people will program whatever because they like to program- I just program because I want more games).
The problem with D is it seems to have veered off from being a simpler and more consistent C++ with a GC to some template metaprogramming heaven.
Now that he's playing with constness (do you know the difference between const/final/invariant?), I'm tempted to ask: why didn't he make a compiled functional language to begin with? At least there would be no runtime/compile-time dichotomy. Templates, static if, CTFE, textual mixins, tuples, constness... all those concerns would either be gone or unified.
"Static if"? Is that some kind of code for "our optimizer is a piece of shit"?
>>30
Yes. Also, "we have an irrational dislike of the C preprocessor".
D also seems to have a problem with string literals being mutable char arrays. Which can have three effects: a) shit blows up when one tries to change a string literal's contents; b) a string literal is duplicated into the GC heap whenever one is referenced; or c) the string literal is copied lazily on modify, which kind of breaks arrays due to changing the underlying pointer and adds "is this bit set? no? then gosub copy" logic to every last damned char array write.
Someone tried to present this as a problem to the D users in their newsgroup a few years back. The result was that some fangirl pounced on the chance to protect the tribe, saying that "D doesn't need Java's String class".
There doesn't seem to be any point to D. It's not Java, it's not C#, it's definitely not C++ and yet it brings none of the features of more advanced languages (type inference? oh no.) to the table. Also, it manages to have more horrible template syntax than C++, and a worse module system than Python.
Oh, wait, D has constness now? Ha ha. Guess they came around then.
D's concept of constness is more nuanced. It's also harder to remember, in large part to a poor choice of keywords. No matter how many times I read the difference between const/final/invariant, I seem to have forgotten by the next week. This contrasts starkly to Walter Bright's normal philosophy of making it easy to do the right thing and more difficult to do the wrong.
Not to bash D too harshly. It's written by a master at C++ compilers (Walter Bright), played with with by a C++ guru (Andrei Alexandrescu), and used by a community of experienced C++ developers. And it shows. I feel that D really is in most ways a better C++ than C++ as a language (which ignores the critical issues of libraries, community support, and richness of toolset, which C++ obviously wins).
Of course, a better C++ that C++ isn't all that great in my opinion. Alexandrescu has argued that supporting library developers is critical, and catering to library developers with all the metaprogramming goodies does appear to be paying dividends for D. D has drawn a largely C++ crowd, so cater to them.
However, I'll argue that any language that has template metaprogramming is fundamentally flawed. It doesn't matter how similar the syntax is, you've essentially chopped the language into two very different languages. C++ has an excuse: the accidental discovery of functional programming with templates allowed the almost-frozen and very limited C++ to be extended beyond its original capabilities.
D doesn't have that excuse. So unless something changes dramatically, I don't think it'll reach much beyond an enthusiast community inhabited by a core group of former C++ developers.
Not to say you're a total fucktard, but you're a total fucktard.
C++ is for mentally retarded beginner programmers.
Beginner programmers can't possibly understand C++.
>>33
Yes, I agree. Template metaprogramming is how one does "clean" (ha!) macros in C++, and duplicating it rather than doing a proper syntax-level macro system is nothing short of retarded. Doubly so when languages such as Haskell have demonstrated that most of the time resorting to explicit templates shouldn't be necessary, i.e. that most code should be implicitly typed anyway. Furthermore, the properties of types should be expressed formally in the language itself, rather than the "this model has these methods" formalized commenting styles of C++ TMP.
D is, in short, an improved and superficially rethought C++. And that doesn't go very far anymore.
>>37
In actuality, you probably started on BASIC or LOGO, you're just repressing those traumatic memories.
True enough. I started on Apple BASIC, and then did a bit of assembler for Apple ][. Then I did nothing for several years and started serious programming on C++.
So what does everyone think of the new specification of C++ called C++0x?
>>40
I guess the new, pervy uses of template metaprogramming have to be formalized somewhere. I hope there won't be a C++1x or a C++2x.
Why does everyone bash C++? What's so bad about it?
Mostly that there is too much of it. It doesn't have the simplicity of C, and it doesn't have the higher-level features of other languages.
>>42
I dislike it because of the temptation to "library programming".
>>44
Unable to google a definition for that term. "Library programming" meaning what?
Relying on libraries of already written code?
Maybe >>44 meant template metaprogramming.
Given the relative inflexibility of the language, it's tempting to over-engineer to be safe.