[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Question on replacing macros with static inline functions
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Tue, 15 Nov 2022 18:57:31 +0100
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)?
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.
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
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.
On 14/11/2022 17:45, Roberto Ierusalimschy wrote:
I noticed that Lua code sometimes uses macros where a static inline
would appear to work equally as well.
How interested would the Lua development team be in replacing such
functions in the future?
Inline functions is not present in C89, and Lua is (still) compatible