delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/23/20:30:03

From: jbs30000 AT aol DOT com (Joel)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: malloc question.
Date: 23 Jul 2003 17:19:24 -0700
Organization: http://groups.google.com/
Lines: 28
Message-ID: <84e4e2a9.0307231619.53a48663@posting.google.com>
References: <84e4e2a9 DOT 0307230454 DOT 730046e5 AT posting DOT google DOT com> <bfm1d7$db6$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: 152.163.252.163
X-Trace: posting.google.com 1059005964 13265 127.0.0.1 (24 Jul 2003 00:19:24 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 24 Jul 2003 00:19:24 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote in message news:<bfm1d7$db6$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>...
> Joel <jbs30000 AT aol DOT com> wrote:
> > From here
> > http://www.delorie.com/djgpp/doc/ug/graphics/vbe20.html
> > I used code to get protected mode function offsets.  And instead of
> > using vesa_pm_info I just called it VESA_PM.
> 
> Please re-think that decision.  By ancient tradition in both C and
> C++, NAMES_IN_ALL_CAPS are reserved for #define'd macros and possibly
> enum labels.  You'll mislead anyone else who may get to read your code
> later.
> 
> > I got the error:
> > svga/VBESetup.cpp(12) Error: invalid conversion from `void*' to `
> >    Vesa_Protected_Mode_Info*'
> 
> That's a C++-specific thing, whereas the sample you looked at probably
> was meant to be C code.  Unlike C, C++ doesn't let you silently cast
> points from and to void *.
> 
> > But of course that doesn't necessarily mean that I'm doing this right,
> > so I'd like to know, is that correct, or else how am I supposed to fix
> > the problem?
> 
> C++ purists may insist on using one of the more explicitly meaningful
> types of cast, or tell you to use "new" instead of malloc(), but the
> fix you found is essentially correct.
Didn't realize about the all caps rule, thanks for the info.

- Raw text -


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