lua-users home
lua-l archive

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

> - Get a copy of the ISO standard and be familiar with it.

I would love to do this, except it appears to be pay-to-play, so I've
been relying on a very late draft.

Am I wrong and it is indeed available openly?

> - Avoid features that behave differently in C++.  (Well, that's the
> definition of Clean C...)

Well, I'd not go quite that far.  For example, I would not consider it
unclean C to use identifiers that are keywords in C++ but not in C as
variable names.  (Lua may want to avoid such a thing, but I'd say
that's less "clean C" and more "clean C for Lua".)

> - Always use as many warnings as feasible (and fix all warnings).

Oh, good gods, please don't go that far.  "As many warnings as
feasible", in at least some of the compilers I've run into, includes a
whole lot of warnings that (in my opinion) are of low-to-negative
value.  Just looking at one handy gcc manpage, I see
-Wformat-zero-length, -Wswitch-default, -Wunused-value,
-Wsystem-headers, -Wfloat-equal, -Wtraditional, -Wlarger-than-*,
-Wunsafe-loop-optimizations, -Waggregate-return, -Wmissing-noreturn,
-Wmissing-format-attribute, -Winline, -Wdisabled-optimization, and
possibly -Wstrict-aliasing.  I'm sure each of those has a place, but I
don't think this is an example of such a place.  Maybe Lua wants to
avoid all such, but then, again, there's the difference between "clean
C" and "clean C for Lua" - but even for the latter I would hope that
some of those wouldn't be wanted.

I'd also add -Wc++-compat to the list when talking about clean C in
general; it was mentioned above, but my impression was that that was,
in the terminology above, more "clean C for Lua".

> - Avoid implicit "multi-step" type conversions (e.g., float ->
> unsigned char).

What's multi-step about that?  Are you talking about the default
arithmetic conversions converting float to double before that goes to
unsigned char?  Then you'd have the same issue converting, say,
unsigned char to unsigned short int, because it's going to pass thorugh
int (or, on a few systems, unsigned int) in the process.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B