delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/29/15:48:14

Message-ID: <35799AC6.9941AACE@go.ro>
Date: Sat, 06 Jun 1998 22:38:46 +0300
From: Radu Georgescu aka skoola <skoola AT go DOT ro>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Some nice questions!! (one of them is silly!)
References: <01bec0de$10cd1120$LocalHost AT thendren>
Reply-To: djgpp AT delorie DOT com

> >   1) if i declare 2 global arrays as follows...
> >       char ar1[100];
> >       char ar2[20];
> >    will djgpp ALWAYS store ar2 exactly after ar1???
> >   i.e. will the expression ar2[-1] always return
> >ar1[99]??
>
> you should never assume that two variables are in proximate memory
> locations.  the compiler and link-editor are under no requirement to put
> them next to each other.  this is what USUALLY happens, but it's not safe to
> assume that it will ALWAYS happen.
>

he may declare those arrays in some struct with __atribute__(packed)...

- Raw text -


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