[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Portability of Lua
- From: Jay Carlson <nop@...>
- Date: Tue, 30 Apr 2013 15:26:45 -0400
On Apr 30, 2013, at 9:01 AM, Roberto Ierusalimschy wrote:
>> It can't be more portable than the language it's implemented in.
> Of course, that depends on your meaning of portability. C has way too
> many non-portable features, so programs written in C usually are
> non-portable. You can write very portable programs in C, but you must be
> *very* careful. If we follow the standard, a lot of things we take
> for granted in C are undefined and should not be used in portable programs
Very well said. I wish this were printed in the preface to every text on the C language. The conforming ANSI C compiler on the 36-bit, word-addressed Sperry SX1100 is not the weirdest you can get.
Microprocessor development has been shaped by "make C fast" too, so rather than everything converging on a PDP-11/VAX/68000/i386-flat model, processor and OS designs are shaped by what's allowable in the standard and what won't break *too* much non-conforming code. (I think the SVR4 ELF dynamic linker is too deferential, but for some reason saying "Windows DLLs are healthy, like good vigorous exercise" is unpopular.)
> So, a language implemented in C, but making judicious use of its features,
> can be more portable than C, in the meaning that the "chance" of an
> "arbitrary" program in that language work in different platforms is
> higher than the chance for an arbitrary program in C.
This is parallel to how languages which compile to C as an intermediate language can be faster than C.