[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: OT Clean C standard?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 24 Jun 2010 13:54:46 -0300
> On Thu, 24 Jun 2010 09:27:07 -0400
> Patrick <email@example.com> 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