Mail Archives: djgpp/1998/01/08/07:28:29
At 11:00 08/01/98 +0200, 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.
>
Eli where did you get evidence for this affirmation? C language definition
says "the compiler should issue a warning, but is not illegal" to do such an
assignement. I'm don't have the ANSI specs at hand now to quote the section
and verse, but this is the idea.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak E-mail: csrabak AT ipt DOT br
DME/ASC Phone: 55-11-268-3522 Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax: 55-11-268-5996
Av. Prof. Almeida Prado, 532. Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Raw text -