It was thus said that the Great bil til once stated:
>
> (I do not really understand the problem you have with long long int
> ... your other points I anyway do not really understand, I would need
> a short "problematic example" for all of these).
>
As Roberto said, Microsoft didn't really support C99 for a *long* time,
and there are a ton of embedded C compilers that never got C99 support as
well, and Lua was designed for as wide usage as possible. And for the list
Robert presented of C99 features:
- long long int
- preprocessor working with 64 bits
- header stdint.h
These all guarantee 64-bit support. Prior to C99, no guarantee
at all.
- inline directive
Inline function calls, like C macros, but with better type checking and
less unwanted side effects.
- mixing declarations with code
This allows declaring variables as needed, instead of at the top of a
block scope. Also, you can declare variables inside the for() declaration:
for (int i = 0 ; i < max ; i++)
{
}
to really limit the scope of the index variable.
- Compound literals
For me, this is a "must have". Easiest with an example:
XSetWMProperties(
display,
window,
&(XTextProperty) {
.value = (unsigned char *)"Programmer's Calculator",
.encoding = XA_STRING,
.format = 8,
.nitems = 23,
},
&(XTextProperty) {
.value = (unsigned char *)"Programmer's Calculator",
.encoding = XA_STRING,
.format = 8,
.nitems = 23,
},
argv,
argc,
&(XSizeHints) {
.flags = PMinSize | PMaxSize,
.min_width = width,
.min_height = height,
.max_width = width,
.max_height = height,
},
&(XWMHints) {
.flags = StateHint | InputHint,
.initial_state = NormalState,
.input = True,
},
&(XClassHint) {
.res_name = (char *)"XPCalculator",
.res_class = (char *)"XPCalculator",
}
);
Otherwise, this code would have to be:
XTextProperty name;
XTextProperty icon;
XSizeHints sizehints;
XWMHints wmhints;
XClassHint classhints;
name.value = ...;
name.encoding = ...;
/* and so on, for all the above variables */
XSetWMProperties(display,window,&name,&icon,argv,argc,&sizehints,&wmhints,&classhints);
Remember, two of the hardest problems in computer science are cache
invalidation, naming things, and off-by-one errors. And by using compound
literals, I can avoid having to name things. This also shows another C99
feature---designated initializers.
- 'strtod' with support for hexadecimal (used by the core)
Nothing to add here.
These are all features of C99 that Lua doesn't use or has to work around
for C89.
-spc