Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting... Please check out the Community Guidelines in the
Announcements and Administration Category, below.

Re: RE: RE: Re: [BULK] Re: Modern C++ Features in Kernel Mode Drivers

Prokash_SinhaProkash_Sinha Posts: 1,214
I read this before, worth reading again :)

> On Jul 9, 2018, at 10:16 AM, xxxxx@gmail.com wrote:
>
> The Linux kernel has some 100,000 goto references. The Goto wars have been around since the late 60's.
>
> I use them, but rarely. I don't go out of my way to code around them. They just happen when they need to happen.
>
> This is a fun read: http://wiki.c2.com/?GotoConsideredHarmful
>
>
> On Mon, Jul 9, 2018 at 5:15 AM xxxxx@gmail.com > wrote:
> > some people are just too dumb to see the advantages that goto statement offers
>
> Fair enough, but if you read the tone of my post I did not say goto never makes sense, just that I personally have never used it and that pretty much everyone seems to be taught goto is evil. Personally, I would be willing to entertain valid usages. I think it must exist in multiple languages for a reason.
>
> > if(status) goto done;
> > Which of them do you think is easier to read and maintain???
>
> I have seen code like this before. I personally prefer nested if's to facilitate cleanup lining up clearly through horizontal indentation. Both approaches I think are ugly. It's a developer decision. C++ Exceptions would solve this elegantly however.
>
>
> ---
> NTDEV is sponsored by OSR
>
> Visit the list online at: >
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at >
>
> To unsubscribe, visit the List Server section of OSR Online at >
>
>
> --
> Jamey Kirby
> Disrupting the establishment since 1964
>
> This is a personal email account and as such, emails are not subject to archiving. Nothing else really matters.
> --- NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at To unsubscribe, visit the List Server section of OSR Online at

Comments

  • Tim_RobertsTim_Roberts Posts: 12,567
    xxxxx@garlic.com wrote:
    > No, I’m not. Last thing I remember was the GDI drivers ( on the graphics side), and IIRC it has C++.

    No, GDI drivers were all in C.  That's how I got my start.  Some of the
    user-mode printer DLLs used C++.


    > Where does it live in the stack ? Is it top level driver ?

    Yes.  AVStream and Port-class drivers are both miniports.  Your web
    camera and your sound card are both being driven by C++ code.


    > If it can be executed in arbitrary context, can you use exception ? I guess not !

    Of course not.  You've never been able to use exceptions in the kernel,
    and you still can't do so today.

    I will say that, 10 or 15 years ago, I encountered a project that
    originally came from one-time driver luminary Walter Oney.  He had
    created a library and a set of assembler glue code that DID enable the
    use of C++ exceptions in the kernel.  It was frightening.  I backed
    slowly away.

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

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!