From: Groepaz (groepaz_at_gmx.net)
Date: 2003-09-25 22:24:25
mmmmh... i gave the testsuite another try (wondering if i ever manage to bring
it to a state worth uploading :P) ... more problems arise it seems :/
(all of this works with gcc)
1)
struct node
{
int a[4];
} x = {
1,2,3,4 <- line 14
};
./src/stdarg.c(14): Error: `{' expected
./src/stdarg.c(15): Error: `}' expected
this works:
struct node
{
int a[4];
} x = {
{ 1,2,3,4 }
};
2)
struct node x =
va_arg(
ap,
struct node
); <- line 61
./src/stdarg.c(61): Error: `{' expected
./src/stdarg.c(61): Error: `{' expected
./src/stdarg.c(61): Error: Constant expression expected
./src/stdarg.c(61): Error: `}' expected
./src/stdarg.c(61): Error: `}' expected
mmh not sure if this one should work... but even if va_arg is a real function
(and thus cant take the struct by value) i'd expect a somewhat more specific
error message ;=)
3)
struct odd {char a[3]; } y ={{'a', 'b', 0}};
odd(struct odd y)
{
struct odd x= y; <- line 141
fprintf(outfile,"%s\n\r", x.a);
}
./src/struct.c(141): Error: `{' expected
./src/struct.c(141): Error: `{' expected
./src/struct.c(141): Error: Constant expression expected
./src/struct.c(141): Error: `}' expected
./src/struct.c(141): Error: `}' expected
i know this one shouldnt work at all, but also in this case a more specific
error message would be nice :)
4)
typedef struct point { int x,y; } point;
point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 }; <-line 230
./src/struct.c(230): Error: `{' expected
5) last not least i tracked down the bug that prevented the testsuite (better,
the posix-directory functions) from working....
---------
typedef struct
{
unsigned char fd;
} DIR;
DIR mydir;
int dirfd(DIR *dir)
{
printf("dirfd: %d (should be 123)\n",dir->fd);
// return((int)(dir->fd)); // makes it work
// return((unsigned char)(dir->fd)); // doesnt work
return(dir->fd); // doesnt work
}
int main(void)
{
unsigned char fd;
mydir.fd=123;
fd=dirfd(&mydir);
//fd=(unsigned char)dirfd(&mydir); // does NOT make it work
printf("readdir:fd=%d (should be 123)\n",fd);
}
------------
appearently the "dir->fd" isnt correctly promoted to "int" without the
explicit cast.
gpz
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-09-25 22:29:51 CEST