Learn C++ or learn C first and then C++?

Metalloid

Diamond Member
Jan 18, 2002
3,064
0
0
Should I learn C before I learn C++, or just go straight to C++.

EDIT: Oops hit enter while in title bar. :eek:
 

Metalloid

Diamond Member
Jan 18, 2002
3,064
0
0
Originally posted by: notfred
If you don't care to know C, jsut go straight to C++.

I was always under the impression that C++ was more powerful than C. Are there any aspects of C that I won't get from C++?
 

everman

Lifer
Nov 5, 2002
11,288
1
0
Learn C to what extent? I've learned C++ as well as learning how some things are done in C as opposed to C++. IE: in C++ you can use classes but not in C.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Either or will do.

I was always under the impression that C++ was more powerful than C. Are there any aspects of C that I won't get from C++?

Real lowlevel stuff, mostly usefull for OS/driver programming.
 

Metalloid

Diamond Member
Jan 18, 2002
3,064
0
0
Originally posted by: Nothinman
Either or will do.

I was always under the impression that C++ was more powerful than C. Are there any aspects of C that I won't get from C++?

Real lowlevel stuff, mostly usefull for OS/driver programming.

I think I will just start with C++ then. It's kinda cool. I will be a senior in HS next year, and 2 of my friends and I are taking and Independent Study class for computer science engineering under the supervision of my Physics teacher, so we will get to study C++ and whatever else we want. :)

Thanks for the help guys.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
C is also usefull because a lot unix programs (and as such, Linux programs) are done in C. Infact the ratio of C to C++ is probably on the order or 10 to 1.

And added good thing is that a ton of those programs are open source so you can download the source and learn from them.
 

glugglug

Diamond Member
Jun 9, 2002
5,340
1
81
C is a subset of C++, so in essense you'd really be learning both at once.

I say learn straight C first. It's important to get the basic concepts down and understand whats happening at a relatively low level before you start adding complexity with OOP, templates, etc.
 

kleinesarschloch

Senior member
Jan 18, 2003
529
0
0
I say learn straight C first. It's important to get the basic concepts down and understand whats happening at a relatively low level before you start adding complexity with OOP, templates, etc.


good advice. get a copy of kernigan and ritchie second edition and a C compiler. after that C++ will be a breeze, as well as any other language you might want to learn.
 

VBboy

Diamond Member
Nov 12, 2000
5,793
0
0
Go straight to Visual Basic if you want to write high-level apps easily. Yes, it allows you to write code more caressly, but it's the programmer's fault most of the time. With Win32 API, VB becomes a very powerful tool.

Having just typed 5 lines of code simply to change the font of a CStatic control in MFC/VC++, I can back up my statement with facts :)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Yes, it allows you to write code more caressly, but it's the programmer's fault most of the time

That's the problem, VB doesn't make you actually learn how to program. If you start on VB you'll inevitably get some really bad programming habits that will cause problems if you try to move to any other language.

Having just typed 5 lines of code simply to change the font of a CStatic control in MFC/VC++, I can back up my statement with facts

That sounds more like a MFC problem than a C++ one =)
 

kleinesarschloch

Senior member
Jan 18, 2003
529
0
0
Originally posted by: VBboy
Go straight to Visual Basic if you want to write high-level apps easily. Yes, it allows you to write code more caressly, but it's the programmer's fault most of the time. With Win32 API, VB becomes a very powerful tool.

Having just typed 5 lines of code simply to change the font of a CStatic control in MFC/VC++, I can back up my statement with facts :)

5 lines... how do you manage? ;) seriously though, i have found that i spend very little time typing and much more time designing, testing and documenting code. typing code is NOT the bottleneck.
 

VBboy

Diamond Member
Nov 12, 2000
5,793
0
0
Originally posted by: Nothinman
Yes, it allows you to write code more caressly, but it's the programmer's fault most of the time

That's the problem, VB doesn't make you actually learn how to program. If you start on VB you'll inevitably get some really bad programming habits that will cause problems if you try to move to any other language.

It is possible to misuse anything. Visual Basic makes it easier, but it's a tradeoff people are willing to make. If you learn the language by the book, not by dropping controls on your form in any which way, your program will work well, efficiently, and in a friendly manner.

Having worked with Visual Basic for 6 years and C++ for 3 years, I can say that VB is much easier to develop in, but somewhat less powerful. But hey, who here is writing mouse drivers or code for microprocessors?
 

Chaotic42

Lifer
Jun 15, 2001
34,804
1,985
126
I say learn C first. Once you learn C, other languages like C++ and even Python will be very simple to learn. Lots of things are written in C, especially in the Unix world. I learned C first, which made learning C++ pretty simple.
 

eklass

Golden Member
Mar 19, 2001
1,218
0
0
if the C++ book/class/whatever you're learning from is teaching C first, you can probably skip it, although the C++ books tend to glaze over a lot of stuff that you would use in C. i would recommend getting a good C book so you can understand the concepts and why you do things a certain way. then go to C++.

It would make Bjarne Stroustrup happy if you did it that way, because he never meant C++ to be a replacement of C, but an extension of the language.
 

xirtam

Diamond Member
Aug 25, 2001
4,693
0
0
your program will work well, efficiently, and in a friendly manner.

Please don't use those three adverbs when describing the operation of a visual basic program. It causes something deep inside me to scream. Particularly number two. Any time "Hello World" doesn't compile small enough to fit on a disk (including installer), something's wrong.

Yes, it allows you to write code more caressly, but it's the programmer's fault most of the time

When it's a compiler feature to deal with crappy structure and you have to include the command OPTION EXPLICIT to get the compiler to make you be a good boy, it's a language for my little sister. VB is the LOGO opiate of the masses. Do your time and get out.

VB's good for prototyping, but all of that's assuming you can tolerate Windows and it's incredible sense of bloat long enough to do anything. The only things I would consider actually developing in VB is simple windows programs I don't care about and Microsoft Office integration. I mean, if it's a feature of your software that it's supposed to be inefficient and only work on one type of platform, then sure, use VB. Oh, and the ActiveX integration sucks. Always has since the first 32 bit release (4.0, I believe, which included both a 16-bit version and a 32-bit version.)

I don't write mouse drivers because I don't have a need to write them. But there's no way on God's green earth that I'm going to write my touchscreen drivers in VB. Or anything MFC related, for that matter. The code has to be able to work on linux, windows, what-have-you. And I obviously can't do anything from Drug-Dealer Microsoft and their Visual Studio Bloatware Suite.

It's not like I'm spouting off crap about VB with no basis. I've used it since 3.0. No idea how many years that is... probably around 10. And I will take VB over any of the other Visual Studio products. If all you've programmed in is something like QBasic, VB will get you out of DOS and into the Windows development arena. Whether that's a good thing or a bad thing... is up to you.

Now, back on track. Whether you want to learn C or C++ depends on what you want to do. I'm guessing more application-based programming, so I'd go with C++. When the time comes for you to start messing around with drivers or linux development and you want to start writing lower-level code, C won't be that bad of a transition.

I'm starting to get more into assembly, myself. When I'm not doing the mandatory web-based scripting thing.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Having worked with Visual Basic for 6 years and C++ for 3 years, I can say that VB is much easier to develop in, but somewhat less powerful. But hey, who here is writing mouse drivers or code for microprocessors?

I know VB is easy, if it wasn't it wouldn't have a point. But unless you already have experience when you start learning VB you'll get yourself into some bad habits that will be really hard to break. VB has it's place but I don't think it's a good starting point.

And I havn't done any mouse drivers, but I have debugged kernel drivers on my box when I've had problems. C knowledge is also invaluable when trying to merge conflicting kernel patches.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
C++ will give you a good foundation in object-oriented programming, and it will force you to manage memory and understand pointers and references (something that managed languages such as Java or C# do for you). C++ will be more difficult to learn than Visual Basic or Java, but like others have said, you will develop good programming habits that will carry over to newer languages. If you ever need to write something in C, a background in C++ will allow you to pick it up quickly.
 

glugglug

Diamond Member
Jun 9, 2002
5,340
1
81
VBBoy, the difficulty you are running into is most definately a MFC issue not a C++ issue.

Get C++ Builder and do visual development in C++ even EASIER than VB (using borland VCL libraries/components rather than MFC).

I am most definately with Nothinman on this one... VB teaches you really bad habits making other languages more difficult to pick up later.
Maintaining the ability to talk with VB's backwards datatypes/threading model is also probably the #1 source of difficulty when you do COM from other languages.
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
Originally posted by: kleinesarschloch
I say learn straight C first. It's important to get the basic concepts down and understand whats happening at a relatively low level before you start adding complexity with OOP, templates, etc.


good advice. get a copy of kernigan and ritchie second edition and a C compiler. after that C++ will be a breeze, as well as any other language you might want to learn.

I'm gonna say learn C++
But Klein's advice is good. Get a copy of Kernigan and Ritchie and just pretty much read through the first couple chapters. After that, leave C behind and jump straight to C++. If you didn't know, Kernigan & Ritchie *wrote* C and they created the smallest and most to-the-point book on C ever.
 

kleinesarschloch

Senior member
Jan 18, 2003
529
0
0
Originally posted by: Smilin
Originally posted by: kleinesarschloch
I say learn straight C first. It's important to get the basic concepts down and understand whats happening at a relatively low level before you start adding complexity with OOP, templates, etc.


good advice. get a copy of kernigan and ritchie second edition and a C compiler. after that C++ will be a breeze, as well as any other language you might want to learn.

I'm gonna say learn C++
But Klein's advice is good. Get a copy of Kernigan and Ritchie and just pretty much read through the first couple chapters. After that, leave C behind and jump straight to C++. If you didn't know, Kernigan & Ritchie *wrote* C and they created the smallest and most to-the-point book on C ever.

that book was an eye opener for me. it is very compressed and you will learn C in a very short time.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
I'm willing to bet that those making all the diatribal comments about VB know VERY LITTLE about VB. Calling it "easy" just shows ignorance, as you're talking purely about the high-level semantics of its syntax. A language should be abstruse to be considered difficult?

VB has been highly used in the context of enterprise applications, and no, not just "hello world" applications. Not acknowledging this just shows lack of knowledge/experience. VB had a strong place in the context of Windows DNA as COM component middleware, and it has an even larger place in the context of .NET.

I don't understand how a language can TEACH you anything. C++ can "teach" you very bad habits as well; things like buffer overflows, poor OO design, loosely typed issues (i.e. void *), ad nauseum. It is up to the developer to KNOW the language and to KNOW the nuances. It is up to the developer to employ sound methods when implementing anything in any language.

That said... I really don't enjoy VB's syntax; never have. Just because I don't like the syntax does not mean it's not a powerful tool. My *preference* has always been C-derived syntax languages, but that doesn't mean it's always the right language for the job.

Language dogma gets you nowhere. Language dogma shows lack of professionalism and inexperience.
 

xirtam

Diamond Member
Aug 25, 2001
4,693
0
0
I agree with a lot of your points, and acknowledge that VB is the right tool for the right job in a few select cases.

But if *all* you know is VB, you're hurting. And the reason I say this is because of the confines VB does place you in. Put a VB-only programmer in a unix environment, and he'll be completely lost. Now, if you know for sure you'll never need anything besides windows and programs like office integration (I wasn't suggesting that "hello world" was all you can do with VB... I've done a lot with VB. I was just saying that if the compiled result for a "hello world"-quality-application + installer for the "native" distribution was huge, VB couldn't be that efficient), then by all means, VB all the way.

I never called VB easy. You can make VB as hard as you like. Especially if you start messing around with the Windows API and make all these system level calls that nice little boys and girls don't do.

Obviously those worried about VB "teaching" bad habits are those who have found the joys of more structured languages and the better programming practices these languages typically enforce. But your points on that issue are well-taken. Use the right tool for the right job. Sometimes, it's VB. More often, at least in my world, it's not.