delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/08/07:28:29

Message-Id: <1.5.4.32.19980108122547.006b6e94@dce03.ipt.br>
Mime-Version: 1.0
Date: Thu, 08 Jan 1998 10:25:47 -0200
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, David Eberhard <toothpck AT xmission DOT com>
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Re: problem with memory allocation (I think)
Cc: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019