Where is C

Started by
57 comments, last by mikeman 17 years, 8 months ago
I have been learning C language since summer, i tried other languages but somehow C just seemed to be the simplest language to learn for ***ME***. Now i wanna know where C stands as compared to other languages as to popularity, and ease of use with the More popular APIs like opengl, Directx, SDL and Allegro based on facts not on your opinions. THANKS
Advertisement
OpenGL and C work together very well. OpenGL was ment to be for C and i have used this combo, as for the rest, i believe you will need C++. I would learn C++ as soon as possible. C++ is just a superset of C and is backward compatible, it just adds stuff like classes, which are commonly used.

Greetings.
You can use DirectX with C++, but i personally think that it feels more natural to work with classes in this case.
As far as I know SDL can work in C.


I do agree that you should learn C++. Since you know C right now, it will only take a little bit to know how to use it. IMO it is easier then C.


Chad.
Quote:Original post by Limitz
I would learn C++ as soon as possible. C++ is just a superset of C89 and is backward compatible, it just adds stuff like classes, which are commonly used.


Corrected. Also, it is advised to forget everything you know about C before starting C++.

To answer the OP's question, C is historically popular because it provides the most popular means of using libraries. The Windows API as well as the core UNIX and Linux libraries are written in C and provide a C interface. Besides, except for the recent .NET libraries and some historical artifacts, accessing any library from C is extremely simple. The other reason why C is popular is that, being a glorified assembly language, it can run on almost any platform known to man, and thus provides ultimate portability as long as system calls are not involved. This includes space probes, airplanes etc ...

Since the appearance of C++, the use of C for library access has declined. Even though C++ is not as powerful as C as far as creating library interfaces goes, some do provide C++ bindings (for instance, DirectX). The appearance of .NET brings an end to the dominance of C on the Windows API, and KDE has moved away from C and into C++ some time ago already. In game development, except for a few notoriously skilled programmers, C++ is used whenever possible, with its C-inspired subset being used whenever necessary. This, of course, in cases where the game development language isn't ActionScript, Java, C# or some variant of LISP. The fact that most C compilers are bundled with (or part of) C++ compilers only adds to the hegemony of C++. Right now, C is still used in its historical niches (such as UNIX systems programming), platforms without other language support (such as embedded Airbus chipsets) and some libraries, but most of the work is done either in C++ or in C++-- (that is, C++ used as if it were C, which some may consider an abomination).

Of course, C has been abandoned long ago by almost everyone in many domains where productivity (as opposed to optimization potential) is important. Replacements and alternatives are Java or C# for business needs, Visual Basic for management of Office and similar components, PHP/Perl/ASP for dynamic web pages, and (remarkably) C++ for finance.
Quote:Original post by Limitz
C++ is just a superset of C and is backward compatible, it just adds stuff like classes, which are commonly used.

That is a grossly inaccurate description of C++.
Quote:Original post by Limitz
C++ is just a superset of C and is backward compatible, it just adds stuff like classes, which are commonly used.

Not even close. C++ is it's own language and shouldn't be seen as 'C with classes' like many of the first books used to publicize. C++ includes functionality of the C language but is in no way a superset as there are many fundamental differences and many C'isms that you should never use.
well C++ has tiny insignificant differences (syntax-wise) from C..
Although it really is a totally different languages, the programming concepts are all the same (as it is with almost all languages), but even the syntax is almost the same..
the only new concepts introduced are Objects ... that is classes and structures.

Without those it is very hard to write a fully structured program and you will have truble maintaining and remembering your functions after your game jumps over the 1000 lines...

I really suggest you move to C++ and forget everything you know about conventional function calling... use classes WHENEVER you can.
Quote:Original post by memento_mori
the only new concepts introduced are Objects ... that is classes and structures.


You forgot templates, references, exceptions, namespaces, overloading, RTTI, safer casts, an entire crapload of standard library functionality, and several other details as well.

Quote:Without those it is very hard to write a fully structured program and you will have truble maintaining and remembering your functions after your game jumps over the 1000 lines...


You can code an object oriented design in C without too much difficulty as well, even if it isn't as simple.
Quote:Original post by memento_mori
the only new concepts introduced are Objects ... that is classes and structures.


Let's also not forget:

templates
function overloading
references
exception handling
namespaces
anonymous namespaces
specifically-typed enumerations

As someone who learned C first, then C++ as an extension to C, before realising that this was a very dumb way to be taught C++, I feel I am reasonably well qualified to point out that C++'s "backwards compatibility" with C (and I use the quoted words advisedley) was purely commercially motivated and it is a great shame that so many academic institutions still feel that this is a good way to "educate" people.

[EDIT] Sorry, ToohrVyk. I was just a bit too slow there.

This topic is closed to new replies.

Advertisement