With cryptic symbols (==) instead of more obivous (EQ) for operations, a syntax heavy on the shift key and a designed-in way to combine multiple statements in a very unclear manner (normal+=smith++/10; which is really normal = normal + simth/10
and smith = smith + 1) the language seems unnecessarily obtuse. I cannot imagine why the language is so popular. I would like to hear a rational answer not an emotional one.
Why is C and/or C++ so popular when it seems so cryptic and confusing and difficult to maintain?
That's why your using OS right now because of C/C++/C#
Reply:C is meant to be a minimal and easy to compile language that's a step above assembly language. 'Minimal' is why you have to write so much code to get anything accomplished. 'Easy to compile' is why a line of code looks like you smashed your fist on the keyboard. But object code is very fast because it is compiled directly to machine language instead of into byte codes processed later by an interpreter (Java, BASIC, .Net, etc.). So for high performance and system- or hardware-level programs, C is the logical choice.
You'll also find that a lot of popular languages are somewhat C-like, so you might as well get used to it. :)
Reply:C is one of the most efficient languages, that's why it's good for operating systems and drivers that depend on speed. I personally don't see a reason for C++ to exist. If you want object oriented, you should go with a real OO language, and if you want efficiency, you should go with C.
It's true that the language will allow you to write some very ugly code. I suppose this can be seen as a weakness, but in any language the programmer is responsible for making things readable.
As far as == vs EQ, I don't see it as being less obvious. It's just a syntactical difference.
Reply:My two cents worth:
1). Unless they've downgraded it, C is a third generation language with all the abstractions that are implied. It is extensible with itself, assembler or Pascal. It plays well with others and allows for a great deal of code reuse when properly wielded.
2). The fact that the C / C++ pre-processor commands are so flexible and convenient allow code to be ported in seconds if the original programmer was wily and judicious in its use.
3). There is the fact that C was the creation language of UNIX, the original Bell Labs operating system. It was also adopted for the creation of Linux and Windows code bases. And remains to this day the language of the Win32 API, be it ever so aged now. It will likely be found that Microsoft, as aggressively progressive as they are most of the time, has written a lot of even the Vista code in C. Code re-usability *AND* easy hardware level access are issues that make me confident of this.
4). There is no *LACK* of C code anywhere in the real world of software. C code lives in every instance of a Win32 or Win32s API application, Linux, Unix and many other application's code base.
5). C++ is an *EXTENSION* of the C language, a very good and useful one. It can be every bit as safe or safer than Java when correctly used. As a matter of fact, Java packages and extensions can be written in C or C++. And the C code base is reused by the new C++ applications, often by simply creating a container class and interface from it.
6). New areas of usage for C are opening up in embedded work. Most micro controller technologies are now supported by the manufacturer or third party with a C compiler as well as the standard assembly language.
7). This is a two edged sword, but answers one of your objections directly. Why so many operators and combinations? Well, the C language contains only 35 ( if I didn't miscount or accidentally include some compiler specific keywords) keywords in all. Its eloquence is that this forms a basic compiler system with the operators that would allow one to duplicate the ANSI standard libraries from scratch and source if they weren't included, even without an assembler as a separate entity in some cases.
I don't expect you to be swayed from your position, nor anyone who is a C++ or Java enthusiast from theirs. I do expect that we should all just grow up and realize that different languages are beneficial for different environments, types of programming and people using them. I wouldn't try and use Java to write a complex stand alone application running natively (no virtual machine, I know they exist, but emulations make my skin crawl!) on a mainframe. Nor would anyone try and use C to write a client side HTML embedded script, because the environment and architecture don't support that. You could, of course use CGI, but that isn't client side and definitely not capable of running on the client machine as a Java applet would.
I do hope that I've clarified ( and not over evangelized ) the reasons C can and should be selected for some things.
Reply:Because it is closer to assembly language and offers more, true hardware control. In other words it is more closer to machine language and more explicit. It does not pretend to cater to human comfort needs like basics or pascal or any other third level languages. It is crazy but efficient. Assembly language is worst.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment