lua-users home
lua-l archive

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

Embedded systems can have a very long life cycle (20+ years) and many of our customers use legacy build systems.


That's Interesting.

Out of curiosity, could you disclose which kind of systems are you talking about and whether they are just legacy systems or something that is actively developed (from the manufacturer side, I mean)?

-- Lorenzo

On 15/11/2022 15:58, Wilfred Nilsen wrote:

Yes, it is absolutely necessary to keep Lua C89 compatible. We work with embedded systems and many environments use old C89 compilers.


Hi, Roberto,

I was thinking, is it really worth the hassle to keep Lua compatible with C89 nowadays? Shouldn't it be moved to C99, whose features would help make the code clearer and more maintainable? After all we are talking about a 30+ years old standard that was the first attempt at standardization of C.

The fact that C89 is rather flawed (from a modern language POV) is evident (IMO) from how many improvements C99 introduced, many of which are given for granted in modern languages and systems. Just to name a few off the top of my head: long long int type with guaranteed minimum 64bit width, fixed width integer types, variable declarations at the point of usage, line comments, boolean types, IEEE754 support, type-generic macros, inline functions, complex numbers (BTW, I would welcome native complex numbers support in Lua). Even later C standards didn't introduce so many and deep innovations as those introduced in the leap from C89 to C99, if my memory serves me correctly.

I have a feeling that nowadays no one creates compilers that are just C89 compatible any longer, even for exotic new systems (e.g. newer low-cost MCU families) that require a quick and dirty compiler put together in a hurry. C99 seems to the baseline even for the simplest and dumbest C compiler out there. Is it really worthwhile to keep developing Lua using a C89 programming style?

Just my two cents.


-- Lorenzo

On 14/11/2022 17:45, Roberto Ierusalimschy wrote:
I noticed that Lua code sometimes uses macros where a static inline function
would appear to work equally as well.

How interested would the Lua development team be in replacing such macros with
functions in the future?
Inline functions is not present in C89, and Lua is (still) compatible
with C89.

-- Roberto