www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/18/08:39:25

Date: Wed, 18 Feb 1998 10:17:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Donnie Roos <d DOT roos AT st DOT hanze DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: assigning the correct adress?
In-Reply-To: <34e9a8df.2317141@news.rug.nl>
Message-ID: <Pine.SUN.3.91.980218101709.8118F-100000@is>
MIME-Version: 1.0

On Tue, 17 Feb 1998, Donnie Roos wrote:

> word TMP;
> byte *ptr_TMP_l, *ptr_TMP_h;
> 
> In my code i try to assign it in the following way.
> It needs a cast to increase the adress by 1 byte instead of a word.
> 
> ptr_TMP_l = & (byte) reg_TMP;
> ptr_TMP_h = & (byte) reg_TMP + 1;
> 
> When compiling my source from RHIDE (default options) i get the
> message: invalid lvalue in unary `&'

Warning: UNTESTED code follows!!

  typedef unsigned char byte;
  typedef unsigned short word;
  word TMP;
  byte *ptr_TMP_l, *ptr_TMP_h;
  ...
  ptr_TMP_l = (byte *)&TMP;
  ptr_TMP_h = ptr_TMP_l + 1;

- Raw text -


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