C++ language : badly designed ?
Hello all,
I wrote a page about C++ : http://www.ifrance.com/programmershouse/ What do you think about it ? It is an introduction to C++, what else usefull could I add ? thanks --------- C++ LANGUAGE : One of the languages known as "Object Oriented", i.e. which uses the concept of classes. It is a language which takes as a starting point the C language. It was created by Bjarne Stroustrup in 1990. C++ was standardized (ANSI/ISO) in 1997. It is a badly conceived and complicated language : to avoid, like Basic, Pascal, C # and others. C++ disadvantages : * It is not portable. * Code is not protected. * It doesnt control the types. * It is not multitask. * Memory management is complicated. COMPILERS : Allows to go from the code (.c) to the executable (.exe). The best compilers are : GCC http://www.mingw.org/download.shtml <-- the best LCC http://www.cs.virginia.edu/~lcc-win32/ CYGWIN http://sources.redhat.com/cygwin/ MINGW32 http://www.mingw.org/download.shtml LINKS : BOOKS : Many C++ books are full of blah-blah which dont mean ANYTHING ! Dont buy any of them. You will lose your time and money and sanity. Except : « The C++ programming language », third edition, Bjarne Stroustrup |
I agree with some points and I think they are good, especially the one about memory management. However, there're plenty of good books, specially "How Not to Program in C++" and "The Definitive Guide to GCC".
When I write (or try) critics, I try to see both sides of something, the good and the bad ones. I also try to not be to fanatic about one specific thing: Saying that only one book about C++ is good and all others are waste of money considering the number of books, pocket books, electronic books and etc written about C++ exist (and I doubt you read more then 3 or 4) is way to personal and add little to the article/review... But indeed, this is just my personal thoughts :) |
Re: C++ language : badly designed ?
Programming languages are merely tools to get a particular job done. Each has its own strengths and weakenesses depending on the requirements of the application. So your article is pretty meaningless without actually stating the genre of software to be coded in C++.
Quote:
- C++ code that adheres to the ISO standards is portable. - I'm not too sure about what you mean by code being not protected. Could you elaborate more? - Likewise with "it doesn;t control the types". - The language itself doesn't know anything about threading, but system calls do provide that feature. |
You bring up some criticisms that have been leveled at C++ many times in the past, but you haven't actually provided any kind of support for your argument that C++ was "badly conceived" and should be avoided.
I find it especially curious that your page on the C language says "The best programming language", when most of those C++ criticisms may also apply to C - even more so, in some cases. Memory management in C is even more complicated than in C++ (since the programmer must know how much to allocate; the C++ 'new' does that for us); C is more weakly typed than C++ is. Portability problems could be said to apply to any language not using a virtual machine of some sort; tell me, how long (in bits) is a 'long int' in C or C++? The length differs by architecture, making code dependent on a particular length less portable. |
Quote:
With C I can allocate what I need where I need. ok I have to know the processor architecture, but at least I control all what is happening. This is not the case with C++. With C++, the black box does it for you and not in a very optimized way. C++ "new" can lead to undetectable memory errors in some cases. Portability is easily solved in C when one use architecture independant types. |
Re: Re: C++ language : badly designed ?
Quote:
Quote:
|
Re: Re: Re: C++ language : badly designed ?
Quote:
And it's funny how you think C "does it pretty well" when they suffer from the same "deficiencies". Earlier posters have addressed these issues in detail, so I'll not restate them. Quote:
Quote:
|
Re: Re: Re: Re: C++ language : badly designed ?
Quote:
do you use PHP for coding a processor, signal processing algorithms, drivers, OS (like unix and linux for ex), etc etc. yes C language could also do dynamic web develoment, but the code would be quite long, but it CAN do it. C language is close to the machine language, so anything a machine can do, C can do, that means all. Quote:
Quote:
It is a cousin of C++ with some notable differences : * It is portable : the same executable file can be used by any processor. * It is protected : mechanism of code control. * It is robust : it controls the types. * It is powerful : because multitask. * "Garbage Collector" manages the memory automatically. (I think better than C++) Java is better than C++ as an object oriented language. You cannot compare it with C which is not oo. |
Re: Re: Re: Re: Re: C++ language : badly designed ?
do you use PHP for coding a processor, signal processing algorithms, drivers, OS (like unix and linux for ex), etc etc.
yes C language could also do dynamic web develoment, but the code would be quite long, but it CAN do it. C language is close to the machine language, so anything a machine can do, C can do, that means all. I've already stated in an earlier post that C is designed with a low-leve bias. And as such, it is the perfect tool for those things you have mentioned. It is however, NOT ideal for high-level development like web dev, and therefore far from being your claim of "A good language should be good for all tasks" in your earlier post. My point from the very start is that there is no one perfect language, but there is the right kind of tool for the right kind of job. C is not perfect, but other languages are not better. As per the previous point. Use the right tool for the right job. And those tools includes C++. no java is better than C++ cf my page on Java After rereading your page and earlier posts, I think your assumption on memory management in C++ is way off. You are assuming that C+ has some sort of gc capability and then go off to compare that assumed gc with Java's gc. The thing is that C++ itself does no automatic memory mgmt, so there is no basis for the comparison at all. Any heap mem which you have allocated, you are responsible for freeing, similar to straight C. In fact, C++ exception handling capability actually simplifies resource clean up... eg. Imagine a function that needs to alloc heap mem in different places, and release them on any errors. In straight C, unless you use gotos, your cleanup code gets compounded in every error check. eg... Code:
char *p1 = NULL, *p2 = NULL, *p3 = NULL; Code:
char *p1 = NULL, *p2 = NULL, *p3 = NULL; |
programmershous, it sounds to me as though you are mostly interested in debating your viewpoint, rather than being open to the comments and suggestions you asked for in your original post. Here are my suggestions, if you wish to improve your webpage about C++:
Basically, I think if you're going to make such broad condemnations of the language, you should at least back those statements up with some comparisons to other languages: why C++ does certain things poorly that other languages do well. You have claimed that no language is better than C. Given the many other languages that are available, would you use C to do dynamic web processing? Would you use C to manipulate strings? If so, more power to you, but other languages most certainly are better than C for those things (PHP and Perl, respectively, are two that come to mind). Also, if you believe that "C is close to the machine language", you haven't done any kind of coding in lower-level languages, nor have a very good understanding of what "machine language" is actually like. C is a relatively high-level language. It has a strong level of capability for low-level coding (especially since it's possible to embed assembly into it), but I would hardly say it's anywhere close to machine language. Even modern assembly languages are somewhat abstract and high-level in some respects. |
Quote:
Now lets rip to shread those points up there... 1). Nothing is portable. Except assembler on the same platform with no calls to any kernels. Java is not portable either since the whole damn thing runs in a virtual operating system that someone wrote for your platform. 2). Show me code that is protected... Nothing is protected from a debugger! Encrypted code doesnt work either since the key to decrypt it is somewhere in there... 3). It doesnt need to... Remeber this is like a friendly assembler. There are no such things as types in the first place. 4). It is not multitasking? Ever heard of threads? 5). It is just as complicated as assembly. C++ has all the features of C... |
Stack: i never seen mips assembly, but i done some x86 assembly, and i cant seem to see how c is like it very much (but there are some resemblances) .... and i think c is a lot less complicated then assembly, in assembly you have to move this around, call this, find what part of memory the screen is located at, move everything there
assembly is easier to use then c for some things tho ... but in c you don't have to know what the number are (so less research,) just as the computer to fetch them for you, and store them in some variable to use them later |
Profanity is the one language all programmers know.
|
Quote:
Very portable too ;) |
Oh yeah, works in any environment.
|
All times are GMT -5. The time now is 02:53 AM. |