Liste des Groupes | Revenir à cl c |
On 07/04/2025 19:02, Michael S wrote:On Mon, 07 Apr 2025 05:45:19 -0700
No.Of course, proposals for similar feature in other procedural/imperativeThat's news to me. But then I only used an educational version.
language would not be totally different. Pascal is more similar to C
than many other procedural languages, so solution for Pascal would
likely be more similar to C than for example, stackless co-routines
that already exist in such languages like C# (that started current wave
of popularity of the feature) or Python.
However Pascal and C have enough not in common for significant
difference in proposed syntax and implementation. Specifically, in
Pascal:
- heap management is built-n in the language
- non-local goto is built-n in the language
- nested proceduresI don't think it's that strictly specified in C. Isn't it vaguely left to the implementation?
- everything related to separated compilation of the translation units
is handwaved in the docs rather than strictly specified.
Much of how different units share macros, types, structs and enums isn't part of the language at all AFAICS: it's just a by-product of different modules happening to include the same header files.Linkage is explained in 6.2.2 - only identifiers with external linkage are shared amongst translation units. Macros, types, enums are all have no linkage and are therefore never shared.
But it could also be done by repeating declarations in each module; it's rather ad hoc.It is not remotely "ad hoc" - as far as the language is concerned, including a header file /is/ repeating the declaration in the different translation units. The way C handles this kind of thing is arguably weaker than in languages that have proper modules (like Ada, or Modula 2), and much more open to mistakes. On the other hand, it is very flexible and simple to understand, and does not need additional specialised object files or "interface" files. It is possible to write C code in an "ad hoc" manner (such as declaring an "extern" identifier within a C file rather than a header file), but the language definition is not "ad hoc".
The Pascal I used only worked with one module; more recent versions do seem to have formal interfaces which are part of the language. So it is more rigorous than C.Yes, most Pascal versions suitable for real development (rather than the older teaching versions) have more formal interfaces. Personally, I prefer more formal interfaces - more formality and stronger typing reduce flexibility but also reduce the risk of some kinds of errors, and can make a language more amenable to analysis.
I suspect you are wrong here. There are certainly far more C compilers than Pascal compilers, and there are minor variations between the C compilers, but even prior to K&R's book the differences between C compilers was smaller than between the different Pascal versions. Pascal was standardised, but standard Pascal was too limited for most commercial use and different vendors build on it - with Borland's line being the most relevant. Comparing modern Delphi and standard Pascal is a bit like comparing C# with K&R C.May be it'sI have a feeling that there were WAY more variations of C than Pascal, largely because C was more popular and more widespread.
not so in Extended Pascal standard, I never read it.
>
Most importantly, Pascal in its hay days had different (from C)
attitude with regard to standardization. Implementors, especially
bigger ones, freely made very significant mutually incompatible
extensions and nobody in community was upset about it. C way is more
centralized.
You still see this know when you delve into systems and applications headers which are often a mess of '#ifdef' blocks which special-case specific compiler versions which all have different characteristics.Certainly there are variations in the details - in particular, there are lots of things in C (and Pascal) that are "implementation defined".
Les messages affichés proviennent d'usenet.