articles/c.md: update
This commit is contained in:
parent
9a7583521e
commit
29d4656e3a
1 changed files with 7 additions and 5 deletions
|
@ -2,12 +2,13 @@
|
||||||
C is a procedural, compiled [programming language](programming_language.md) created by Dennis Ritchie in 1973 for use in the Unix operating system.
|
C is a procedural, compiled [programming language](programming_language.md) created by Dennis Ritchie in 1973 for use in the Unix operating system.
|
||||||
Despite being an [old](old.md) language, it remains very relevant and it will stay that way for the next 100 years and more.
|
Despite being an [old](old.md) language, it remains very relevant and it will stay that way for the next 100 years and more.
|
||||||
|
|
||||||
When compared with "modern" programming languages, C is a simple and minimal language, since it lacks "modern" features such as
|
When compared with "modern" programming languages, C is a simple and [minimal](minimalism.md) language, since it lacks "modern" features such as
|
||||||
generics, memory safety, standard data structures and other high-level constructs, for that it is generally considered a low-level
|
generics, memory safety, standard data structures and other high-level constructs, for that it is generally considered a low-level
|
||||||
language, even though strictly is a high-level language, since it abstracts over the platform dependent assembly language, effectively
|
language, even though strictly is a high-level language, because it abstracts over the platform dependent [assembly language](assembly.md), effectively
|
||||||
turning C into a portable assembly. Detractors are quick to point nonsense such as "C can't be a portable assembly because it forces
|
turning C into a portable assembly. [Detractors](rust.md) are quick to point nonsense such as "C can't be a portable assembly because it forces
|
||||||
an abstract model", ignoring the fact that C being so influential that any CPU architecture meant to be taken seriously has a compiler
|
an abstract model", ignoring the fact that C being so influential that any [CPU](cpu.md) architecture meant to be taken seriously has a compiler
|
||||||
for it (therefore a CPU made to efficiently execute C, incidentally or not).
|
for it (therefore a CPU made to efficiently execute C, incidentally or not).
|
||||||
|
|
||||||
Additionally, it is quite unforgiving and does not handhold the programmer at all,
|
Additionally, it is quite unforgiving and does not handhold the programmer at all,
|
||||||
in part this is good since it forces to actually think what one is doing, unlike in modern languages.
|
in part this is good since it forces to actually think what one is doing, unlike in modern languages.
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ Currently there are multiple independent compilers (non exhaustive list):
|
||||||
(Portable C Compiler): classic portable compiler from the Unix days, successor of Ritchie's C compiler.
|
(Portable C Compiler): classic portable compiler from the Unix days, successor of Ritchie's C compiler.
|
||||||
- [OpenWatcom](https://openwatcom.org/): a C compiler from the DOS days, proprietary.
|
- [OpenWatcom](https://openwatcom.org/): a C compiler from the DOS days, proprietary.
|
||||||
- MSVC: proprietary compiler from [Micro$oft](microsoft.md), notable for being stuck in ANSI C for decades.
|
- MSVC: proprietary compiler from [Micro$oft](microsoft.md), notable for being stuck in ANSI C for decades.
|
||||||
|
- ...and many more implementations
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
### Hello world
|
### Hello world
|
||||||
|
@ -89,7 +91,7 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return 1;
|
return 1;
|
||||||
/* in "real" code you want to use the strtol/strtoul functions */
|
/* in "real" code you may want to use the strtol/strtoul functions */
|
||||||
int n = atoi(argv[1]);
|
int n = atoi(argv[1]);
|
||||||
printf("fact(%i) = %lli\n", n, fact(n));
|
printf("fact(%i) = %lli\n", n, fact(n));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue