delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/12/10:15:10

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "JANE AMBUHL" <jambuhl AT mastnet DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: casting a pointer of a pointer
Date: Sun, 12 May 2002 08:52:33 -0500
Organization: Trip Net Internet Services
Lines: 37
Message-ID: <abls3b$1cmu$1@trip.net>
References: <4PpD8.150757$v7 DOT 14044373 AT bin6 DOT nnrp DOT aus1 DOT giganews DOT com>
NNTP-Posting-Host: dial-e5-238.houston.trip.net
X-Trace: news.hal-pc.org 1021211563 45790 208.187.141.238 (12 May 2002 13:52:43 GMT)
X-Complaints-To: <abuse AT trip DOT net>
NNTP-Posting-Date: Sun, 12 May 2002 13:52:43 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"FYS" <zfysz AT cybertrails DOT com> wrote in message
news:4PpD8.150757$v7 DOT 14044373 AT bin6 DOT nnrp DOT aus1 DOT giganews DOT com...
> In MS VC6.x and MS QC2.5, the following compiles as
> expected:
>
> unsigned short repcnt;
> unsigned char *li_s;
>
> // get the WORD at li_s
> repcnt = (unsigned short) (unsigned short *) *li_s;
>
>
> What I am trying to do is get the WORD at the BYTE PTR's
> location.  In VC6.x and QC2.5, the above compiles and
> works as expected, but not in DGJPP.
>
> link.c:927: warning: cast to pointer from integer of different size
> link.c:927: warning: cast from pointer to integer of different size
>
> What is the DJGPP equivalent to the above code?

Surely
 repcnt = *(unsigned short *)li_s;    /* possible alignment problem for
portable code */
or
 repcnt = (unsigned short)*li_s;
is what you meant.

Your problem is not djgpp, but the language itself.  Your example line of
code has, at best,
typing practice in it.  Be sure that you are not confused about what you
want and that you
don't need to review the C language as well.



- Raw text -


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