Mail Archives: djgpp/1998/01/08/09:38:43
Eli Zaretskii wrote:
>
> Also, please note that it is usually a bad idea to put a long into a
> buffere which was malloc'ed for int's, like you do:
>
> long i;
> unsigned int *buffer;
> ...
> buffer[i] = i;
>
> This works in DJGPP, since int and long are both 32-bit, but on other
> architectures it will crash.
Isn't it true (at least in ANSI C), that the above code will be compiled
as:
buffer[i]= (unsigned int)i;
What you say means, that you should not write:
double x=5;
int *buffer;
........
buffer[i]= x;
Mirek
- Raw text -