From: dontmailme AT iname DOT com (Steamer) Newsgroups: comp.os.msdos.djgpp Subject: Re: Help! Date: Fri, 20 Oct 2000 21:27:24 GMT Organization: always disorganized Lines: 64 Message-ID: <39f0b88a.48929103@news.freeserve.net> References: <002001c03ac9$ebe70fc0$0500a8c0 AT brk> NNTP-Posting-Host: modem-53.black-angel.dialup.pol.co.uk X-Trace: newsg4.svr.pol.co.uk 972077245 26918 62.136.232.53 (20 Oct 2000 21:27:25 GMT) NNTP-Posting-Date: 20 Oct 2000 21:27:25 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Johan Henriksson wrote: > >> It's quite unavoidable to learn C if you learn CC... > >Why go to all the trouble of learning C++ if all you want to learn > >is C? > * You can read ~100% more sources to others apps True, but by that logic you should also learn Java, Perl, etc., while you're at it, then you could read even more sources. > * You get a better understanding of programming and OO I don't think C++ is very good for learning object-oriented programming. Java is surely better. Smalltalk may be even better, but it isn't very popular. > >How are you going to know which parts of C++ are also C? > You get a parse error :) True... > Seriously, I think books should be > more careful about how they write. CC is an "addon" and > should be threat like one. I think it is better to consider C++ as a separate language. A typical C++ program doesn't look much like C at all, with all that object-oriented stuff, exception handling, new/delete instead of malloc/free, cout instead of printf, etc. > >And how are you going to find out about all those little things > >which are different in C? > Is anything different? None of my older books tells anything about that. What is the type of 'a'? (C answer: int. C++ answer: char.) A C++ compiler will choke on char *ptr = malloc(9); although this is fine in C. There are other differences, but I can't remember them all at the moment. Somewhere there is a web page listing differences, but I've lost the URL. Here's a silly program that prints out the name of the language it was compiled as - I'll let you work out why: #include typedef int foo; int main() { struct foo { int x[2]; }; char *arr[] = { "++", "" }; printf("C%s\n", arr[sizeof(foo)==sizeof(int)]); return 0; }