So recently I've begun my age-old quest of actually learning C++.
I've attempted this several times, and like most who give up, stopped after learning the very basics of the language, as I didn't really know where to go from there.
I'm not really looking to be developing specifically for Windows, but I realize that it will be where I do the majority of my work, so does anyone have anything against C++/CLI? If so, why?
Furthermore, what are some ideal "projects" to try to design?
Thanks /prog/,
anon
Name:
Anonymous2008-08-10 20:12
I'd avoid C++/CLI unless you're doing CLR interop, primarily because I don't know of anyone who uses it for anything else, and so it's probably a waste of time unless you'll be doing that.
If you're learning C++/CLI, you're learning a different language (of course, this is blatantly obvious, but it should be said). I would stick to C++, that way you'll learn common C++ idioms and patterns instead of .NET idioms and patterns.
Games are a fun way of learning. I'd stick with 2D (or text-based), and keep it simple to start with, so that you'll actually get used to the language before you really start to use it. If you jump right in with something complex, it's likely you'll want to re-write most of it because you screwed it up, which is just generally a total bummer.
The common first game is pong or breakout, then maybe you could go on to make a geometry wars-style game (or whatever interests you). I'd also start off using existing graphics/audio/etc. libraries such as SDL and Allegro before you go wasting your time writing your own shit.
Name:
Anonymous2008-08-10 21:43
Thanks very much anon! ;)
Name:
Anonymous2008-08-11 0:49
But have you read your SICP today?
Name:
Anonymous2008-08-11 5:10
This lack of malignant cancerous tumour appears to doing wonders to this board.
Why can't Microshit touch anything without tainting it with their proprietary filth? They already have "their own" C++ variant with C#, what the hell are they fucking around with C++ for? It shouldn't even be called C++... /RAGE
Anyway, OP, "C++/CLI" is NOT C++. Stay away from it unless you specifically need it.
As for things to start with, as >>2 mentioned... Personally I like to make small apps that I'll actually have use for when learning a new language. Helps maintain motivation, but you need an idea for an app like that of course.
Also, check out CodeProject if you haven't already. They have some nice tutorials/guides there.
Name:
Anonymous2008-08-11 19:04
>>9
C# is their own Java variant, not a C++ variant.
>>9-10
Much as I hate to admit it, C# is actually better than Sepples or Java.
Name:
Anonymous2008-08-11 21:22
What's going on in this thread? Why has no one told OP that Sepples is the worst choice? Why has no one told >>9 that Sepples is the cancer killing computing, so good riddance to it?
Name:
Anonymous2008-08-11 21:39
>>9
I don't see anyone rushing to actually use C++/CLI (or even implement it, apart from Microsoft), so I doubt it's going to kill C++. It is pretty useful in its little niche, though, for writing interop stuff (for example, SlimDX). What would you propose naming it?
>>13
Well, Sepples does have its uses. There's a lot of existing libraries written in it, and it's supported on more platforms than many other languages (I'm thinking of games consoles and mobile/embedded devices).
>>14
It's tempting to see Sepples as a way to bypass an initial investment in libraries, bindings, or somesuch, but do you ever actually come out ahead? Now instead of having a clean slate and a decision to make, you've invested months of work to establish a codebase in a langauge that's out to get you.
Name:
Anonymous2008-08-11 23:27
you've invested months of work to establish a codebase in a langauge that's out to get you.
Easy to fix. Simply use a cfront based compiler to generate C code from Sepples. Then continue writing in C.
Name:
Anonymous2008-08-12 0:41
Sepples is faster than C, and has all its features plus more. Fuck C.
Name:
Anonymous2008-08-12 2:20
>>17
Easier to avoid. Simply begin writing in Lisp.
>>24
I'm not arguing the point that shit C code is slower than Sepples.
do_shit(object, param); dispatcher
Protip: OO is SLOW AS FUCK.
Name:
Anonymous2008-08-12 12:19
>>28
If indirect function calls are a major issue, you're doing it wrong. And Sepples' stricter typing offer more opportunities for optimizing than plain C.
>>29
and templates needless binary bloat, there is no standardized function exporting conventions (C linkage is the only reasonably portable method), the language grammar is horribly ambiguous, complex object hierarchies do generate needless function call overhead, etc.
>>31
Actually, with a modern compiler, templates only instantiate the methods actually used. Hardware C++ programming commonly uses template inheritance exactly for this reason -- the compiler doesn't generate unused code.
Name:
Anonymous2008-08-12 13:28
>>31
Templates cost just as much as writing the methods for the different instantiations manually, unless you have an ancient and/or sucky linker.
The horrible syntax, grammar and portability issues are real problems, unlike the oh-I-just-read-something-that-was-outdated-ten-years-ago-and-that-I-don't-understand-anyway bullshit.
Name:
Anonymous2008-08-12 15:14
>>10
That would be J#. Though, granted, C# probably does have more in common with Java than with C++. However, that doesn't really make a difference because Java is just Sun's C++ variant.
>>12 >>13
I don't think "better" or "worst" can be applied like that. Languages are tools and as such which one is "better" heavily depends on what exactly you're trying to achieve. They all have their own advantages and shortcomings. Singling one out is like saying a screwdriver is the "best" (or "worst") tool and that you'd never use a hammer or a wrench (or vice versa). It's nonsense.
>>14
I don't know what I'd call it... never been good with names. But just calling it C++ and hanging on something as a suffix after a slash is obviously misleading. Point and case: the OP.
While it clearly is heavily based on C++ it's still a completely different language. And not just superficially/syntactically... the way it manages memory is completely different. For example, if you try to get the address of a function you won't get its real address... you'll get an address in a jump table that eventually leads to said function. Now that might not make a difference in most cases, but when it does it's a major pain in the ass when you're not expecting it (ie, expecting it to behave like C++ when it's actually not C++ at all).
Name:
Anonymous2008-08-12 15:36
An all-in-one tool is better than a single-purpose tool.
>>33,34
Each template instantiation generates assembly dedicated for that class == bloat.
"Hardware" (ie, embedded for those of us who actually have a job in the industry) programming is usually done in C where macros and inlined functions are used (and guaranteed) to actually reduce binary size.
Name:
Anonymous2008-08-12 16:19
>>35 I don't think "better" or "worst" can be applied like that. Languages are tools and as such which one is "better" heavily depends on what exactly you're trying to achieve. They all have their own advantages and shortcomings. Singling one out is like saying a screwdriver is the "best" (or "worst") tool and that you'd never use a hammer or a wrench (or vice versa). It's nonsense.
Maybe if there were some stipulation that all languages being discussed be rationally designed. There are few tools as bad as Sepples, because tools are either well-evolved age-old designs (hammers, screwdrivers) or they kill people when they are impossible to operate (power tools). Anyway, Sepples is a flathead screwdriver with a drill bit for a handle (to make it multi-purpose).
Name:
Anonymous2008-08-12 16:31
Learn Haskell instead. You'll be glad you did.
Name:
Anonymous2008-08-12 17:11
Learn Java instead. You'll be glad you did.
Name:
Anonymous2008-08-12 17:12
Learn ABC instead. You'll be glad you did.
Name:
Anonymous2008-08-12 17:18
Learn Befunge instead. You'll be glad you did.
Name:
Anonymous2008-08-12 18:44
>>37
You still don't understand what templates are for or how they work.
Name:
Anonymous2008-08-12 18:51
>>43
Nobody does. They just pretend they do and write books about it to make money off gullible idiots.
Name:
Anonymous2008-08-12 18:57
>>36
That's hardly true. All-in-one tools are generic by nature. In other words, they are mediocre at everything and excel at nothing as opposed to specialized tools which excel at a few things and are shit at everything else. Sure, an all-in-one tool is handy to keep around but it would be foolish to prefer it for a specialized task if you have a choice.
Would you use the knife in a Swiss Army Knife to cut yourself a slice of bread if there was a bread knife right next to you? Would you use its saw to cut a tree trunk if you had a chainsaw lying around? Its scissors if you had proper scissors at hand? Hell, even its bottle opener is so-so. You get the idea.
>>38
[quote]Anyway, Sepples is a flathead screwdriver with a drill bit for a handle (to make it multi-purpose).[/quote]
Maybe so, but sometimes that's just what you need (or at least the best available).
Don't get me wrong, I'd be the first to agree that C++ has its fair share of flaws and then some. But given how widespread its use is and how long it's been around... bashing it like that seems almost as foolish as making fun of the wheel.
Name:
Anonymous2008-08-12 19:42
Wheels are for shitheads. I always program on a stone block so I can avoid these retarded chairs with them flying wheels under. They're obviously just there to make programmers fall when they're being productive, so that THE MAN can exploit us.
- non-dispatched function calls: faster and smaller in C++ than C's function-with-target-as-first-parameter
- dispatched function calls: faster and smaller in C++ than some bullshit manual C dispatch
>>37 Each template instantiation generates assembly dedicated for that class == bloat.
What the fuck bullshit is this? If you need per-class code, you're either compiling different versions (of which the templatized one will be smaller, faster, easier and better error reporting than macro errors (even though template errors are big, they're far more understandable than macro problems)). Your only other option is to do run-time branching, which is slow which "== bloat" as well.
You're just complaining for the sake of complaining and have no understanding of tradeoffs or design decisions, you fucking burger-flipping imbecile.
>>47 Let me dumb it down for you:
good job that is pretty dumb
Name:
Anonymous2008-08-12 23:20
>>47 non-dispatched function calls: faster and smaller in C++ than C's function-with-target-as-first-parameter
Sorry to break it to you, but your Sepples code boils down to the same approach as C in this case. I compiled and checked the assembly code using cfront, so I know what I'm talking about.
Name:
Anonymous2008-08-12 23:32
>>45 a flathead screwdriver with a drill bit for a handle sometimes that's just what you need
No, that has never happened. Ever. No person has ever needed to carve their hand to pieces trying to loosen a screw, or to have a drill bit that can't be put into any drill.
P.S. I'm kind of proud to have created a metaphor that is accurate no matter how far you take it.
Name:
Anonymous2008-08-12 23:48
you fucking burger-flipping imbecile
I like this. It's the best insult I've seen on /prog/for a while.
Name:
Anonymous2008-08-13 1:27
>>49 I compiled and checked the assembly code using cfront
lol, 6/10