This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A bug
- From: Michel Van den Bergh <michel dot vandenbergh at uhasselt dot be>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 16 Dec 2008 18:15:52 +0100
- Subject: Re: A bug
The C standard says no such thing; only integer promotions are
performed. (See 6.5.2.2 of the C99 final draft.)
Ok one more question. Why does this not give a warning then (and runs fine)?
#include <stdio.h>
struct Hello {
char world[20];
};
struct Hello s(){
struct Hello r;
r.world[0]='H';
r.world[1]='\0';
return r;
}
int main(){
struct Hello a;
a=s();
printf("%s\n",a.world);
return 0;
}
In this case an implicit conversion of char[] to (char *) is happening
as well as far as I can see.
Regards,
Michel