www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/01/23:41:14

Sender: nate AT cartsys DOT com
Message-ID: <368DA18C.B83634A4@cartsys.com>
Date: Fri, 01 Jan 1999 20:33:17 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Allegro, pointers : how do I get line from BITMAP?
References: <mvparvia DOT 915186926 AT snakemail DOT hut DOT fi> <368CAA68 DOT 5644E9EA AT alcyone DOT com>
Reply-To: djgpp AT delorie DOT com

Erik Max Francis wrote:
> 
> "Mikko V.I. Parviainen" wrote:
> 
> >   b->line[y][x]
> >
> > Functions well. However, the eight indirections (?) of b
> > for every cell do add significant overhead, so I tried to
> > use an alias for b->line, but could not define the
> > variable.
> 
> What?  I see only three here.
> 
> > In other words, I am trying to define a variable so that
> > I could say
> >
> >   temp[y][x]     to access      b->line[y][x]
> >
> > but cannot find the right expression for temp.
> >
> > If you could point me to the right declaration (or some
> > other solution), I would be mostly thankful.
> 
> Talking generally (I'm not terribly familiar with Allegro), it sounds
> like what you want is a "pointer to a structure member," which is not
> possible in C. 

Huh??? This code:

struct foo {
	int a;
	int b;
} f;

int *g(void) { return &f.a; }

seems to be fine.

But I don't think that's even necessary.  The following should work:

unsigned char **temp;
temp = b->line;


> In C++ you have pointers to class members, but you still
> have to reference the class instance when dereferencing them, so that
> won't do you any good.
> 
> Define a macro if it's really bothering you.


-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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