4 ms·
My favorite Win32 tutorial is by Bartosz Milewski, I found it as a series of posts on his CodeCoop website (https://web.archive.org/web/20110129015721/http://ww
by dotandimet 7y ago
My favorite Win32 tutorial is by Bartosz Milewski, I found it as a series of posts on his CodeCoop website (https://web.archive.org/web/20110129015721/http://www.codecoop.com/ https://web.archive.org/web/20110129015721/http://www.codeco... ), that were later incorporated into his book "C++ in Action" (also findable online).
He uses C++ to wrap every resource acquisition in a constructor and every release of a resource in the corresponding destructor, so that by allocating new objects on the stack you avoid a whole swath of memory management errors. This was my first encounter with RAII (not sure if he calls it that), and it seems a particularly elegant way to write C++ and to make the raw Win32 C API a lot less scary.
- contextfree 7y agoWindows development team now has an internal C++ library used inside Windows source code to do similar things, which was recently made public and open source on GitHub: https://github.com/Microsoft/wil/wiki https://github.com/Microsoft/wil/wiki