🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1214

Re: typecasting preferences

#1214
From: Max Waterman
Date: Fri, 19 Apr 1996 12:26
28 lines
1319 bytes
union Int_Over_Float {
 	 Int integer;
 	 Float floating_point;
	};
	typedef union Int_Over_Float Int_Over_Float;

	Int_Over_Float f;
	Int i;

	f.floating_point = 3.14;

	i = f.integer;

is _not_ the same as

	Float f = 3.14;
	Int i = (Int)f;

They are completely different. The first results in i being something I
wouldn't like to guess at, while the second results in i == 3.

Max.

-- 
    ___                      mailto:dwater@hursley.ibm.com
  /  /  /  _       /     /  _  __ __   _   __   _
 /  /  / /_/ |/  /  /  / /_/  /  /_   /_/ / / / /_/ /| /
/  /  / /  / /|  /_/_/ /  /  /  /_  /  |  / / / /  / / |/
Technical Details
Message-ID: <3177866E.167E@wight.hursley.ibm.com>
Path: arc1-ca.pugleaf.net!hursley.ibm.com!news
References: <4l020g$i9j@srvr1.engin.umich.edu> <Pine.A32.3.91.960416145209.106109C-100000@black.weeg.uiowa.edu> <4l4ldb$nkl@srvr1.engin.umich.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!hursley.ibm.com!news
From: Max Waterman <dwater@wight.hursley.ibm.com>
Newsgroups: alt.msdos.programmer,comp.lang.c,comp.lang.pascal.misc
Subject: Re: typecasting preferences
Date: Fri, 19 Apr 1996 13:26:22 +0100
Organization: IBM UK Laboratories Ltd.
Message-ID: <3177866E.167E@wight.hursley.ibm.com>
References: <4l020g$i9j@srvr1.engin.umich.edu> <Pine.A32.3.91.960416145209.106109C-100000@black.weeg.uiowa.edu> <4l4ldb$nkl@srvr1.engin.umich.edu>
Reply-To: dwater@hursley.ibm.com
NNTP-Posting-Host: wight.hursley.ibm.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.01 (X11; I; AIX 2)