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).