delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/24/22:08:38

Date: Fri, 25 Jul 1997 14:09:46 +1100
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: Converting doubles to ints and chars!?
In-reply-to: <33d535b4.193109@news.algonet.se>
To: djgpp AT delorie DOT com
Message-id: <199707250214.OAA09191@teleng1.tait.co.nz gatekeeper.tait.co.nz>
Organization: Tait Electronics Limited
MIME-version: 1.0
Comments: Authenticated sender is <billc AT blackmagic DOT tait DOT co DOT nz>

On 22 Jul 97 at 22:38, Christian Granstr÷m wrote:
> double X:
> unsigned char Y;
> 
> Y = (unsigned char X);

Y = (unsigned char) X;

> This seems to work until i put Y into an vector. Compilator bug???
> It also works fine if I printf() Y before puting it into the vector!
> 
> Maybe its not supposed to be done this way at all but the
> compiler does'nt complain about it!!

Strange. Are you using C++? If so, you can declare variables (almost) 
anywhere, but I would have thought you'ld get an error about 
redeclaration (unless X is global).
Bill
--
Leave others their otherness.

- Raw text -


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