Drivers coding style

Hi

Is there is any coding style convention in WDK ?
Anywhere I can find windows drivers coding style document?

Thanks
Yossi

Yossi Leybovich wrote:

Is there is any coding style convention in WDK ?

Anywhere I can find windows drivers coding style document?

The samples in the WDK have been produced over a period of almost 20
years, and reflect several quite different coding styles. One of the
first things I do when borrowing code from a sample is to reformat it to
match my personal coding style. You need to establish your own
standards, and then stick to them.

I particularly dislike the DDK convention of starting a function block
comment after the declaration line for the function, but that’s strictly
a personal preference.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Peter Wieland’s blog has some thoughts about coding style on it Yossi.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, September 04, 2008 18:27
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Drivers coding style

Yossi Leybovich wrote:

Is there is any coding style convention in WDK ?

Anywhere I can find windows drivers coding style document?

The samples in the WDK have been produced over a period of almost 20
years, and reflect several quite different coding styles. One of the
first things I do when borrowing code from a sample is to reformat it to
match my personal coding style. You need to establish your own
standards, and then stick to them.

I particularly dislike the DDK convention of starting a function block
comment after the declaration line for the function, but that’s strictly
a personal preference.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3412 (20080903) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3412 (20080903) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Hello,

as far as I know, drivers, like the NT kernel itself, originally adhered
to “NT OS/2 Coding Conventions”, written by Mark Lucovsky and Helen Custer.
But as you can see in various WDK samples, these guidelines were taken
less and less seriously over time.

I have once considered using them, but I found them too vague and
inconsistent in some regards.

  • Cay

On Thu, 04 Sep 2008 17:44:59 +0200, Yossi Leybovich
wrote:
> Hi
>
> Is there is any coding style convention in WDK ?
> Anywhere I can find windows drivers coding style document?
>
> Thanks
> Yossi

Well, there is NOT uniform style in code, but maybe you can learn some from WDK code.
I think coding style contain many aspects, such as indentation(TAB’s wide), how to break long lines, how to place braces and spaces, how to name your variables or function name, and so on…
If you have no idea, you can use a commercial code style editor to learn and watch its style, alternatively you can use free software with ctags-style, I approve of Tim’s opinion, once you are familiar with a certain style, you should insist your style.

Gray