C or C++...

C or C++...

Post by xTractatorix on Tue Jun 12, 2012 9:40 pm
([msg=67194]see C or C++...[/msg])

So which one should learn?
My friend was telling me to learn C instaed of C++ because he says that C has more things in common with the other C languages, like C#,C++, etc, than C++ is this true? I am interested in learning how to write worms,and other complicated algorithoms, is C better at making these types of programs? Lastly can anyone point me to a good website from where to learn C or C++. :lol:
xTractatorix
Experienced User
Experienced User
 
Posts: 61
Joined: Sun May 13, 2012 8:42 am
Blog: View Blog (0)


Re: C or C++...

Post by shaqywacky on Tue Jun 12, 2012 10:19 pm
([msg=67196]see Re: C or C++...[/msg])

I would suggest C++. C++ is essentially C with classes. They are so similar that C code will compile on a C++ compiler(but not the other way around). If you learn C++, you know C.
shaqywacky
Experienced User
Experienced User
 
Posts: 85
Joined: Thu Jul 03, 2008 2:26 pm
Blog: View Blog (0)


Re: C or C++...

Post by centip3de on Wed Jun 13, 2012 2:05 am
([msg=67207]see Re: C or C++...[/msg])

xTractatorix wrote:So which one should learn?
My friend was telling me to learn C instaed of C++ because he says that C has more things in common with the other C languages, like C#,C++, etc, than C++ is this true? I am interested in learning how to write worms,and other complicated algorithoms, is C better at making these types of programs? Lastly can anyone point me to a good website from where to learn C or C++. :lol:


You're friend is an idiot. C++ is much closer to C#, Java, or any other modern OOP language than C is. And anyways, you can do write worms and algorithms in both C and C++, it's just a matter of preference. Oh, and look up K & R for anything C. Also, cplusplus.com works well.

shaqywacky wrote:I would suggest C++. C++ is essentially C with classes. They are so similar that C code will compile on a C++ compiler(but not the other way around). If you learn C++, you know C.


HAHA. Sorry. But if you know C++, you do not know C. They are extremely similar, and all C code is compatible with C++, but C++ code is not compatible with C (much like you pointed out). However, C++ introduces several easier methods of doing things that C just doesn't have. Generally, people learning C++ get very comfortable with these methods and never learn the C way (char array vs string, structs w/ function pointers vs classes, string concatenation, etc. ). Because of this, when many developers make the switch to C from C++, they have to relearn the entire language, essentially.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Moderator
Moderator
 
Posts: 1443
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: C or C++...

Post by shaqywacky on Wed Jun 13, 2012 9:29 pm
([msg=67242]see Re: C or C++...[/msg])

HAHA. Sorry. But if you know C++, you do not know C. They are extremely similar, and all C code is compatible with C++, but C++ code is not compatible with C (much like you pointed out). However, C++ introduces several easier methods of doing things that C just doesn't have. Generally, people learning C++ get very comfortable with these methods and never learn the C way (char array vs string, structs w/ function pointers vs classes, string concatenation, etc. ). Because of this, when many developers make the switch to C from C++, they have to relearn the entire language, essentially.

So you've pointed out exactly what I said but then said it was wrong? Hmmm. As I said in my post, C++ is C with classes. The only differences you have pointed out are classes. If you LEARN C++ you should be very ready for C. I don't know what shit devs you are around but the ones at my work all learned C++ and can easily write C. I have never read a book or anything about C yet I have written many programs in C. And I honestly don't know how you would learn C++ without learning about c-style strings. If you didn't know how to use c-style strings, it should take you 5 minutes because you should already know about arrays, now add a null byte to the end.

I'm sure there are many differences between C and C++ beyond classes but to say that you know C++ but have to completely learn C after is ridiculous.
shaqywacky
Experienced User
Experienced User
 
Posts: 85
Joined: Thu Jul 03, 2008 2:26 pm
Blog: View Blog (0)


Re: C or C++...

Post by centip3de on Wed Jun 13, 2012 10:17 pm
([msg=67243]see Re: C or C++...[/msg])

shaqywacky wrote:So you've pointed out exactly what I said but then said it was wrong? Hmmm. As I said in my post, C++ is C with classes. The only differences you have pointed out are classes. If you LEARN C++ you should be very ready for C. I don't know what shit devs you are around but the ones at my work all learned C++ and can easily write C. I have never read a book or anything about C yet I have written many programs in C. And I honestly don't know how you would learn C++ without learning about c-style strings. If you didn't know how to use c-style strings, it should take you 5 minutes because you should already know about arrays, now add a null byte to the end.

I'm sure there are many differences between C and C++ beyond classes but to say that you know C++ but have to completely learn C after is ridiculous.


I'm pretty sure I already pointed out the parts of my post that agreed with yours. But I also brought out more points than strings vs char arrays, none of which you countered. Also, to have to completely learn C after C++ may be an overstatement, but there are just a plethora of differences between the ways of doing things between the two programming languages. Granted, the syntax is almost exactly the same, once again, the ways of doing things are very much different.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Moderator
Moderator
 
Posts: 1443
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: C or C++...

Post by shaqywacky on Thu Jun 14, 2012 12:58 am
([msg=67247]see Re: C or C++...[/msg])

I did counter them, they were all examples of classes which I already said was the main difference between the two.

As for string concatenation, I'm not sure what you mean by this. I always used strcat() which is available in C and C++.

Whether some people forget or choose to not learn the parts of C++ that are similar to C in favor of using easier methods is irrelevant, those other parts still exist. C++ has many more libraries than C that make things easier but that doesn't mean the ways that don't use the libraries don't exist anymore.

You say the syntax is the same, and that's mainly what I was referring to. I was just noting that if he learned C++ he wouldn't need to learn a whole new syntax for C.
shaqywacky
Experienced User
Experienced User
 
Posts: 85
Joined: Thu Jul 03, 2008 2:26 pm
Blog: View Blog (0)


Re: C or C++...

Post by anarchy420x on Thu Jun 14, 2012 3:31 am
([msg=67248]see Re: C or C++...[/msg])

I love a good debate but in case this takes a turn for the worse I'll leave this here. :P

Image
A broken clock is right twice a day, however, I am neither up that early nor up that late...
anarchy420x
Poster
Poster
 
Posts: 279
Joined: Thu Oct 16, 2008 12:43 am
Blog: View Blog (0)


Re: C or C++...

Post by centip3de on Thu Jun 14, 2012 1:25 pm
([msg=67259]see Re: C or C++...[/msg])

shaqywacky wrote:I did counter them, they were all examples of classes which I already said was the main difference between the two.

As for string concatenation, I'm not sure what you mean by this. I always used strcat() which is available in C and C++.

Whether some people forget or choose to not learn the parts of C++ that are similar to C in favor of using easier methods is irrelevant, those other parts still exist. C++ has many more libraries than C that make things easier but that doesn't mean the ways that don't use the libraries don't exist anymore.

You say the syntax is the same, and that's mainly what I was referring to. I was just noting that if he learned C++ he wouldn't need to learn a whole new syntax for C.


In general, people travel the path of least resistance. It's much easier in C++ to make a class, than it is to make enums/structs/struct function pointers and have to learn an entire new side to the language. So though those parts are still in C++, many C++ developers don't learn them, or if they do, aren't well versed in them. Because of this, they have to learn the "C-styled" way to do things which is quite different from the C++ way. So in general it's more difficult to learn C after initially learning C++, but then again this depends on the programmer. If you've always used the C way of doing things, while also using the OOP parts of C++, you've in essence learned them both.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Moderator
Moderator
 
Posts: 1443
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: C or C++...

Post by mShred on Thu Jun 14, 2012 3:20 pm
([msg=67266]see Re: C or C++...[/msg])

centip3de wrote:You're friend is an idiot...

I'm sorry, I just can't look at that and take it seriously..
anarchy420x wrote:Image

Lol, I like it.
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1766
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)



Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests