Message-Id: <1.5.4.32.19980108122547.006b6e94@dce03.ipt.br> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 08 Jan 1998 10:25:47 -0200 To: Eli Zaretskii , David Eberhard From: Cesar Scarpini Rabak Subject: Re: problem with memory allocation (I think) Cc: djgpp AT delorie DOT com Precedence: bulk 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~