lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

But the point is that the C "standard" leaves some things so open that it's very difficult to write code without making some guesses. Width of an integer? Behavior of C runtime functions? All have very subtle hidden assumptions. For example, when you call "malloc()" you assume that it won't take 5 seconds to allocate memory, but the standard is silent on such issues as API overhead. Writing in standard C is a REQUIREMENT for portability, but not a GUARANTEE.


On Apr 30, 2013, at 11:41 AM, William Ahern <> wrote:

> On Tue, Apr 30, 2013 at 10:01:24AM -0300, 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
>> (e.g., any use of pointer subtraction and ptrdiff_t).
> Technically if you're not following the standard you're not writing in C ;)