Liste des Groupes | Revenir à c arch |
On Tue, 3 Sep 2024 20:05:14 -0000 (UTC)COMMON was a way of passing arguments to functions without paying
Thomas Koenig <tkoenig@netcologne.de> wrote:
>Stefan Monnier <monnier@iro.umontreal.ca> schrieb:>>My impression - based on hearsay for Rust as I have no experience>
- is that the key point of Rust is memory "safety". I use
scare-quotes here, since it is simply about correct use of dynamic
memory and buffers.
>
It is entirely possible to have correct use of memory in C,
If you look at the evolution of programming languages,
"higher-level" doesn't mean "you can do more stuff". On the
contrary, making a language "higher-level" means deciding what it
is we want to make harder or even impossible.
Really?
>
I thought Fortran was higher level than C, and you can do a lot
more things in Fortran than in C.
>
Or rather, Fortran allows you to do things which are possible,
but very cumbersome, in C. Both are Turing complete, after all.
I'd say that C in the form that stabilized around 1975-1976 is
significantly higher level language than contemporary Fortran dialects
or even the next Fortran dialect (F77).
>
EQUIVALENCE is lower level than union.
>
COMMON is ALOT lower level both than C automatic storage and than
dynamic storage (malloc/free) although the later probably was not
considered part of the language in 1976.
IF cond GOTO 42 is lower level than if (!cond) {}In Fortran's defense, it needed a way to pass arguments back without
>
Call-by-reference as the only mode of parameter passing is lower level
than call-by-value. Especially so in context of C, because in C one can
easily emulate call-by-reference with pointers if/when such need arises.
Few other higher level concepts of C appear to have no equivalents atWATFIV did
all in contemporary Fortran:
block scopes for variables, including variables with static storage;
struct;
enum.
I don't remember for sure, but it seems that back then Fortran had no
recursion.
Standardized preprocessor vs at best non-standard macro systems or atI am often put in a position where I have to read the code after
worst nothing at all.
I'd guess there are more features of that sort that I forgot, but theyC was the first language to be able to write all of C in::
are less important than those I listed.
>
Overall, the differences in favor of C looks rather huge.
>
On the other hand, I recollect only two higher level feature present in
old Fortran that were absent in pre-99 C - VLA and Complex.
The first feature can be emulated in almost satisfactory manner by
dynamic allocation. Also, I am not sure that VLA were already part of
standard Fortran language in 1976.
The second feature is very specialized and rather minor.
Les messages affichés proviennent d'usenet.