This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]