Message-ID: <000401c03b8b$10079840$0500a8c0@brk> From: "Johan Henriksson" To: Subject: Re: Help! Date: Sat, 21 Oct 2000 12:31:06 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp AT delorie DOT com from: Johan Henriksson, leadprogrammer @ www.realsoftware.cjb.net "It is not the length of life that counts but what you make out of it" - me ---------------------------------------------------------------------------- ----- >> >> 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. I'd suggest learning basic as well. Then you have most languages covered. >> * 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. I've never tried real Java nor smalltalk so I'm afraid I can't comment on this >> 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. I guess it's a matter of opinion >> >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.) Really? Always thought it was char. But how many will notice the difference? >A C++ compiler will choke on > char *ptr = malloc(9); >although this is fine in C. Is it? Didn't know it was legal with such init's. >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; >} I must say that this code looks so weird you can't have it working. Not even GNU wants to have anything to do with it (read the specs yesterday :)