Luca Forlizzi <
[email protected]> writes:
Do you mean lcc or lcc-win? lcc, as I recall, only supports C90;
lcc-win has reasonably good C99 support (I don't know whether it's
complete).
lcc-win. The compilers output is as follows.
this is my test program:
---------------------------------
#include <stdio.h>
int b;
int main(void) {
int (*ap)[2];
int *pi;
int ai[4]={ 1,2,3,4};
struct st {
float a;
char b;
int c;
} st_v;
st_v = (struct st){ 2.3, 3, 300};
pi = ai;
pi = ( int [2] ){ 1, 3 };
ap = &( (int [2]){ 4, 5});
printf(" pi[0] = %d, pi[1] = %d\n", pi[0], pi[1]);
printf(" (*ap)[0] = %d, (*ap)[1] = %d\n", (*ap)[0], (*ap)[1]);
}
------------------------------------------------
Compiled with "gcc -Wall -pedantic -std=c99" gives no diagnostics and
the program
prints the expected values.
Digital Mars Compiler produces the following diagnostics:
PS D:\temp\prove_c> dmc -A99 compound_literal.c
st_v = (struct st){ 2.3, 3, 300};
^
compound_literal.c(18) : Error: expression expected
pi = ( int [2] ){ 1, 3 };
^
compound_literal.c(20) : Error: expression expected
ap = &( (int [2]){ 4, 5});
^
compound_literal.c(21) : Error: expression expected
--- errorlevel 1
It seems dmc does not support compound literal, even for stucture
types
Lcc-win gives the following diagnostics:
PS D:\temp\prove_c> lc -ansic compound_literal.c
Error compound_literal.c: 20 the left hand side of the assignment
can't be assigned to
Error compound_literal.c: 21 the left hand side of the assignment
can't be assigned to
2 errors, 0 warnings
1 error
So the compound literal for the structure type is ok (as confirmed by
other tests which successfully compile and run as expected), but the
ones for array types are not.
@Ian Collins
Both lcc-win and DMC support many C99 features. dmc has compiler
options for C89, C95, C99 and others. I don't know if they claim to be
C99 fully conformant, probably not.