delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/23/19:15:27

From: "Ole Laursen" <ole_laursen AT hardworking DOT dk>
Newsgroups: comp.os.msdos.djgpp
References: <01bebdc4$9b2e6020$LocalHost AT scarfboy DOT tip DOT nl>
Subject: Re: Dereferencing a void pointer
Lines: 24
X-Newsreader: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Message-ID: <xrdc3.1701$B4.57485@news020.image.dk>
Date: Thu, 24 Jun 1999 00:39:54 +0200
NNTP-Posting-Host: 212.54.73.13
X-Complaints-To: news-abuse AT image DOT dk
X-Trace: news020.image.dk 930177885 212.54.73.13 (Thu, 24 Jun 1999 00:44:45 MET DST)
NNTP-Posting-Date: Thu, 24 Jun 1999 00:44:45 MET DST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>I have a struct with a 'void *data' member, of which the type I assign
>when I judge what data goes in it. The compiler yaks at me when I
>try to offset it like:
>
> to->data[offset]=0;

If

void *data

then it should be

((my_type) to->data)[offset] = 0;

e.g.

((int *) to->data)[offset] = 0;

Hope that helps?

Ole Laursen
Aalborg, Denmark


- Raw text -


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