Just to be precise: C is *NOT* a functional programming language. It's an imperative (or procedural, if you like this word more) language. Functional programming languages are languages like Haskell or Lisp.
Correct. C is sometimes mistakenly referred to as a functional language because the basic unit your imperative statements are organized into is called a function. Many people (including myself) fail to make the proper distinction.
Semantics regarding this usually do not come into play because there are hardly any functional languages in widespread use outside the academic world.
And as for the rest of your article... Well said!
Wow kagerato, great post. I learnt something from that. Thanks
I simply give my best -- there's no point in saying anything if you don't say something meaningful, I feel.
I got lost almost right away, mostly because there are no 2 tutorials for the same compiler, from videos at MSN how to write applications in visual C++ to plain C++ code I can use in CodeBlocks, they are not compatible, CodeBlocks allows me to import almost any format, but mixing them doesn´t work
Absolutely no clue what you're trying to say. "Formats"? Source code is normally stored as ASCII text (or occasionally, using an ANSI codepage or UTF-8 instead). As for C++ "dialects", read further.
I´ve noticed, most of them are written in VB or VC, I´ve even downloaded and installed Visual Studio Express, but for one the code is so way different from gcc, almost an entirely new language and the options are pretty much limited to what the compiler offers
The standard method of GUI programming using Visual C++ is MFC, the Microsoft Foundation Classes. As the name suggests, they are an object-oriented wrapper around the win32 API.
That doesn't have much, if anything, to do with the kind of code and samples you appear to be dealing with. I'm not sure where you picked up the idea that every compiler has its own C++ dialect, completely incompatible with another's. To a very limited degree, that was true ten years ago. It's not a matter of concern these days, as C++ has gradually become more and more standardized.
Visual Basic 6 is not in any way compatible with C or C++ code. It's an entirely different language, one that I would recommend newcomers stay away from.
Visual Basic .NET doesn't have nearly as many glaring problems as VB6. However, using it ties you to the .NET platform. (C# has alternate implementations and uses.) Since the changes made to Visual Basic for the purpose of transforming it into a .NET-compatible language have eliminated several of the original benefits of the language and platform, C# has seen much greater adoption.
By "Visual Studio Express", I believe you mean "Visual C++ Express". Upon last examination, the entire Visual Studio suite was not available for free as a single entity. Rather, there are separate packages for each language.
I don't recommend using Visual Studio -- it's huge and it provides little that a free IDE like CodeBlocks does not (assuming we're working with C++). Furthermore, the Express editions are, in essence, a marketing lure for the .NET platform and other Microsoft-dominated technologies.
Thats where I´m stuck now, I found just ONE tutorial that explains it short and easy at http://www.c-worker.ch/tuts/wstut_op.html (in german) but that one is written for borland and my attempts to translate it to gcc have failed so far, meaning I can´t even start implementing it into my project
Maybe someone here can help me out? How to mix code written for different compilers or how to translate it?
The source for both, is direct available on the page
Client: http://www.c-worker.ch/tuts/sock.c
Server: http://www.c-worker.ch/tuts/socksrv.c
This code is not "written for borland". It's win32 C, specifically using the winsock library. It will build using any C compiler, so long as 1.) the win32 headers are available and 2.) there are no syntax or linking errors.
I successfully compiled "sock.c" using gcc and this command:
gcc sock.c -o sock.exe -lws2_32
The linker command
must go on the end there. (Took me a few minutes to remember this. Had it specified before the source file and was wondering why linker errors were appearing. The GCC man page warns you about this -- always a good idea to read the documentation.)
The fact that you have to explicitly link (using the -l switch, for GCC) to particular libraries is simply a part of C/C++ programming. This little winsock example fails just as spectacularly in Visual C++ if you fail to specify the library correctly.
This example is simple because it's a console application using winsock to provide basic networking facilities. Nevermind that it hardly does anything, let alone provide a "simple chatserver". Don't deceive yourself into thinking it's a simple matter to scale basic examples into production-quality complete applications.
Object oriented programming isn´t new to me (...)
So I know what it is about, I know specially in win32 applications theres a LOT of inherited stuff from the libraries
Oh? You don't seem to know what inheritance is. Inheritance does not mean "included from header files". Inheritance is basing a sub-class on the methods and fields of its parent. Using the win32 API does not involve inheritance. You missed the part about win32 being written in C, and hence lacking any object-orientation.
I still don't like the idea of global and local variables, but I do understand the concept (...)
In C, minimizing global variables is essential to preventing name conflicts and increasing the overall readability of the code. It's a core concept.
In C++, you don't use global variables, period. Furthermore, encapsulating classes effectively by minimizing the number of public fields and methods is a critical part of writing good code. Strong usage of encapsulation leads to easy isolation of bugs, among other benefits.
and what about my actual question? how to "translate" code from other compilers? Theres not THAT much different between borland and gcc (...)
Concerning the referenced code, there is no difference. No compiler-specific feature has been used. Indeed, it's rare to find an instance of it in C code to begin with.
Your problem is simple. Either you do not have your compiler installed correctly, or you do not know how to use it (or the IDE, whichever is relevant).