Re: Re: RAII classes to simplify GDI programming

Philipp Kursawe <[email protected]> Sat, 26 Nov 2011 10:56:21 +0100
Newsgroups gmane.comp.windows.wtl
Message-ID <CAD6pGjxUAYGNGMmTrF4CGsvswOLw=hSVHC57cYwUibuF6O0XtA@mail.gmail.com>
> Thank you for sharing, very useful indeed.
> But I have a doubt on what will occur if I use several instances of the
> same object.
>
> Let's assume this:
>
> CSetTextColor clr1(hDC, RGB(0,0,0));
> CSetTextColor clr2(hDC, RGB(0xff,0,0));
>
> m_oldTextColor for clr2 will be clr1, so restoring the previous DC state
> is depending on which order will the compiler call the objects destructors.
>

No, the order is defined by the specs. clr2 is destructed first, then clr1.

Enjoy,
Phil


[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/