delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/03/14:20:52

From: "Adam Christopher Lawrence" <nospam AT pissoff DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Void pointer problem with datafiles/C++
Date: Wed, 3 Mar 1999 14:25:06 -0500
Organization: Interlog Internet Services
Lines: 27
Message-ID: <7bk1pn$ll2$1@news.interlog.com>
NNTP-Posting-Host: 209-20-9-46.dialin.interlog.com
NNTP-Posting-Time: 3 Mar 1999 19:16:07 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

    As explained in the Allegro docs, using datafile elements in C++ for
function calls causes a void pointer warning, and is (supposedly) rectified
by using a cast.

    The example provided is:

    draw_sprite(screen, (BITMAP *)data[THE_IMAGE].dat, x, y);

    My code has a defined datafile called Data, and it contains bitmaps as
well as a pallete.

    I'm trying to define the pallete by using the set_pallete command:

    set_pallete(Data[PALLETE].dat);

    and am getting the void pointer warning.

    If I try a cast, as suggested in the docs:

    set_pallete( (PALLETE *)Data[PALLETE].dat);

    I get a 'parse error before )' from the compiler.

    How can I code this without a void pointer warning?


- Raw text -


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