lua-users home
lua-l archive

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

> On Thu, 24 Jun 2010 09:27:07 -0400
> Patrick <> wrote:
> > I am re-reading the Lua reference manual. I see that Lua is written
> > in a subset of ANSI C and C++ known as clean C. I would like to
> > improve my C code and what better way then to follow in the Lua
> > developers footsteps but I can't find a references to this online.
> > Could someone point the way?
> I imagine they're simply referring to the subset of ANSI C that is also
> valid C++.


> Mostly, this is avoiding using things like "new" or
> "delete" as identifiers.

There are a few other restrictions (e.g., you cannot convert from
integers to enumerations without explicit casts; type compatibility is
more restricted; a named structure defined inside another structure is
not visible outside that structure; all functions must have prototypes;
you cannot goto into a variable scope), but nothing big. Most restrictions
are over things already considered bad style in C.

> You can't really write a book on how to do that; it comes with experience.

"C - a Reference Manual" (Harbison & Steele Jr., 1995; 4th edition) ends
each chapter with a brief discussion about C++ compatibility.

(I am firmly convinced that it was in that book that I read the term
"clean C", but I was unable to find it again. Maybe I just made up that

-- Roberto