The Old New Thing
We continue our exploration of algorithms for walking incrementally through an N-ary tree by perform a postorder walk through the tree. Recall that our goal is to follow the red arrows through the tree, as if we are walking along the outside of the tree with our left hand touching it. ︎ A ︎ ︎ ╱ │ ╲ ︎ ︎ B ↷ C...
We continue our exploration of algorithms for walking incrementally through an N-ary tree by perform a preorder walk through the tree. Recall that our goal is to follow the red arrows through the tree, as if we are walking along the outside of the tree with our left hand touching it. ︎ A ︎ ︎ ╱ │ ╲ ︎ ︎ B ↷ C ↷...
Suppose you have an N-ary tree, in which the node operations are Get first child. Get next sibling. Get parent. For example, this type of tree structure may represent a window hierarchy. You also see it in a TreeView control. Enumerating the nodes of this tree with a recursive algorithm is relatively straightforward. Doing it incrementally is trickier....
When you use #pragma pack(1), this changes the default structure packing to byte packing, removing all padding bytes normally inserted to preserve alignment. Consider these two structures: // no #pragma pack in effect. struct S { int32_t total; int32_t a, b; }; #pragma pack(1) struct P { int32_t total; int32_t...
A customer was updating some code that manipulated registry key security. The old code used the SetSecurityInfo function to update the security, and they observed that the function propagates inheritable ACEs to child keys. Their revised version used RegSetKeySecurity, and they observed that that function does not propagate inheritable ACEs to...
There’s a nasty gotcha with the DeferWindowPos function, and therefore any functions built on top of it, such as SetWindowPos: If you specify a hwndInsertAfter, and the insert-after window is topmost, then the window being positioned will be placed immediately after that window. So far so good. The hidden gotcha is that the window will be placed...
Build your own newsfeed
Ready to give it a go?
Start a 14-day trial, no credit card required.