www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/21/01:56:41

Date: Thu, 21 Nov 1996 08:47:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Mad <mad AT grupo DOT bfe DOT pt>
Cc: djgpp AT delorie DOT com
Subject: Re: Problems with djgpp 2.01
In-Reply-To: <01bbd6f0$f0f67780$a40141c2@warzone.telepac.pt>
Message-Id: <Pine.SUN.3.91.961121084552.22817I-100000@is>
Mime-Version: 1.0

On 20 Nov 1996, Mad wrote:

> 
> 	i just downloaded djgpp version 2.01 and i'm having problem with the
> rand() function which always assigns 0 (zero) to my variable. For instance:
> 
> 
> int main (void)
> { int x;
> 
>   x=rand();
>   return (0);
> }
> 
> will always assign me 0 to x. Is anyone else haveing the same problem or am
> i the only one?

If you compile this very program, gcc might see that x is never used and 
silently optimize it away.  Try adding a `printf' statement that prints 
the value, or put it into the return statement, and then see if it works.

- Raw text -


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