ALternate Syntaxing: LPDIRECT3D8 vs IDirect3D8*

Started by
6 comments, last by Promit 22 years, 3 months ago
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Advertisement
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

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


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!
I''m the same.

I hate ALL CAPITALS :-)

hard to read.

However I do use them for #define constants. In this case I want them to stand out.
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?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
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
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This topic is closed to new replies.

Advertisement