Re: new IL: C (sort of...).



"Marco van de Voort" <marcov@xxxxxxxx> wrote in message
news:slrnh31mqo.ot0.marcov@xxxxxxxxxxxxxxxxxx
On 2009-06-11, Rod Pemberton <do_not_have@xxxxxxxxxxxxx> wrote:
C has the advantage that it can be implemented for the most part using
very
basic computer science concepts, such as addresses and pointers.
However, C
can be made far more portable with slight extensions. Examples of this
is
Objective-C, and OpenStep.

What exactly is C specific in this point, what doesn't go for say Pascal,
Modula-2,Ada etc?


The implementation of arrays and strings and pointers are different. Pascal
is severely lacking in low-level features, and was lacking pointers.
Basically, you're trapped to programming in a limited box that you can't
escape from. I'm not familiar with Modula-2 or Ada. I'm familiar with a
variant of PL/1 which was very Pascal-ish.

- C requires all objects to be at different addresses.
- C requires all C objects to map onto a contiquous sequence of C
characters.
- C implements an "offset operator" which indexes contiguous sequences of C
characters.
- C doesn't implement arrays.
- C does implement an array declaration. That array declaration is
effectively converted into a pointer that can be used with the offset
operator in order to simulate arrays.
- C doesn't implement strings.
- C does simulate "strings", using an all bit-zero character to terminate a
simulated "array"
- etc.

In other words, you only need a contiquous sequence of C characters and an
address, to implement the (non-specialized) features of C, including
"strings" and "arrays". Just due to the way strings are implemented in
Pascal and PL/1 etc., I'd say C fits better with the underlying computing
platform. However, C has numerous other low-level features that most
high-level languages lack. These too add to it's usefulness as an IL.


Rod Pemberton


.



Relevant Pages