Archived

This topic is now archived and is closed to further replies.

Promit

ALternate Syntaxing: LPDIRECT3D8 vs IDirect3D8*

Recommended Posts

Promit    13246
Most ppl use the LPDIRECT3D---------8 syntaxing. Have you ever tried the other way though? Use the interface name and declare it as a pointer. It''s functionally exactly the same as the LPDIRECT3D--------8 and to me it feels more clear. LPDIRECT3DDEVICE8 looks like a lot of caps which are hard to read at 3am and you cant figure out just what the hell it is. IDirect3DDevice8* is easier to read and it makes it clear that ive got a pointer to an IDirect3DDevice8 interface. DO any of you use the non-caps syntax with the interface name? Why/why not? ----------------------------- The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Share this post


Link to post
Share on other sites
Blaster    124
I prefer the non-caps version, because it's easier to read. Seeing a * instead of P is better.

I do use typedefs like LPCTSTR because they're a nice shortcut for UNICODE-safe code (though I have never compiled for UNICODE).

EDIT - If TCHAR is ANSI, I guess I should use it instead... must check that someday.

----------------
Blaster
Computer game programmer and part time human being
Strategy First - http://www.strategyfirst.com
BlasterSoft - http://www.blastersoft.com

Edited by - Blaster on January 14, 2002 2:21:21 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster

Once upon a time, when we had to build for NT and 98, I created another layer of abstraction:

#define NT_BIULD 1 //: or -0-

#ifdef NT_BUILD
#define LPDIRECTxxxx3 LPDRAWDEVICE
#else
#define LPDIRECTxxxx8 LPDRAWDEVICE
#endif

There were only a few instances where we needed to actually put define guards around code..I think SetVideoMode was one and there was another....anyways..you get the idea


Share this post


Link to post
Share on other sites
Oluseyi    2112
quote:
Original post by Promit
DO any of you use the non-caps syntax with the interface name? Why/why not?

I use the non-caps syntax exclusively now. Why? Because I prefer it, which is all it boils down to - preference.

In fact, the compiler always sees the same thing as the caps versions are simply typedefs for convenience.

Here''s a snip of my init code:
CComPtr<IDirect3D8> pDirect3D;
CComPtr<IDirect3DDevice8> pDevice;
pDirect3D.p->Attach(Direct3DCreate8( D3D_SDK_VERSION ));
int nAdapters = pDirect3D.p->GetAdapterCount();
for(int n = 0; n < nAdapters; ++n)
{
...
pDirect3D.p->CreateDevice( ..., (void **)&pDevice.p);
...
}


[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites
thedo    124
I tend to use the LPDIRECT3D.... syntax. Why? Well my C++ is genrally quite good so problems generally occur with DirectX. Having it in capitals makes it stand out.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites
Lebowski18    122
Indeed it''s just a matter of preference, but I''d like to strongly advise everyone to prefer the non-caps method
Reason:
quote:
LPDIRECT3DDEVICE8 looks like a lot of caps which are hard to read at 3am

Share this post


Link to post
Share on other sites
Promit    13246
Surely anyone of you who''s worked late night has experienced the latters blurring out due to fatigue. Blurred all caps are impossible to read. BLurred Hungarian Notation is at least readable.

I don''t like the CComPtr<> notation, it''s too mnay chars for not enough clarity gain. It seems that a lot of people are moving to the IDirect3DDevice8* style notation.

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Share this post


Link to post
Share on other sites