0

there is something i want to ask about this

LPDIRECT3D9 pdirectX9;

I understand this is a pointer but why do we not use the * like this

LPDIRECT3D9 *pdirectX9;

when i look over my code it confuses me with a struct


EDIT: doing some reading into this, is it because a typedef structure? like

typedef DIRECT3DVERTEXBUFFER9*  LPDIRECT3D9; ?

just renaming this reference? why not just call it direct like

DIRECT3DVERTEXBUFFER9 *pdirectX9;

Thanks

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by thelamb
1

It indeed depends on how the LPDIRECT3D9 is defined, normally you will find a structure definition like:

struct _MYSTRUCT 
{
[indent]int myInt;
string myString;
[/indent]
} myStruct, *pmyStruct;

And then (I think just as a matter of preference) you can define something like LPMYSTRUCT as a pointer to the myStruct.
I use this a lot because I like it more than having *, for example:

typdef unsigned long DWORD, *PDWORD;

will define DWORD as unsigned long and PDWORD as unsigned long pointer. Saves me typing and it's personally more clear to me where I'm using pointers.

Votes + Comments
Good point.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.