Mail Archives: djgpp/2003/07/23/20:30:03
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 -