delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/19/20:55:54

Date: Fri, 20 Jun 1997 12:57:20 -0700
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: help on VESA 2.0 PMode interface and pointers to functions (in
C++)...
To: Jeff Weeks <pweeks AT execulink DOT com>
Cc: djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <33AAE0A0.563B@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <33A988FE DOT 38A29093 AT execulink DOT com>

Jeff Weeks wrote:
> I have three pointers to functions and a structure for the protected
> mode interface:
>  VesaProtected *pm_info;
>  void (*_pm_vesa_switcher)();
>  void (*_pm_vesa_scroller)();
>  void (*_pm_vesa_pallete)();

>   ANSI C++ forbids pointer conversion from void *
> 
> Atleast I think that's it.  Now, I'm pretty sure these lines work fine

Pretty spot on.

> in C.  It's in C++ where they have trouble, so what's wrong?  What has
> changed in C++ to make these non ANSI?  And how can I fix it?

In C++, anything can be assigned to a void* but void* can not be
assigned to anything at all without a cast. Just change your code to
(eg):

_pm_vesa_pallete  = (void (*)())((char *)pm_info + pm_info->setPalette);

BTW, unless you chopped out the parameters for bandwidth reasons, you'll
have to put them in otherwise the compiler will treat the functions as
void foo(void).

Sorry, can't help with the other question.

Bill
-- 
Leave others their otherness.

- Raw text -


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