Mail Archives: djgpp/1997/03/01/15:08:57

From: sammy AT crl DOT com (Samuel McGrath)
Newsgroups: comp.os.msdos.djgpp
Subject: Type casting problems with gcc
Date: 1 Mar 1997 10:51:43 -0800
Organization: CRL Dialup Internet Access (415) 705-6060 [Login: guest]
Lines: 23
Message-ID: <5f9trv$>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm using the Allegro graphics library right now, and I'm trying to 
reference the w and h fields of the BITMAP structure like this:

void* bmp = create_bitmap(320,200);
int bitmapwidth = (BITMAP*)(bmp)->w;

But when the compiler gets to line 2, it tells me that I'm doing an 
invalid typecast, even though I can normally pass bmp to the draw_sprite 
or blit routines.

So the question is, why doesn't GCC allow reference to individual struct 
members via a typecast like the one above?  Please help!

Also, please send a copy of your reply to me, since my news reader tends 
to eat up articles pretty quickly.

Thank you,
Sam McGrath

Sam McGrath:

The character who characterizes something very characteristic in character.

- Raw text -

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