Last time, we learned about the dangers of uninitialized floating
point variables but left with a puzzle:
Why wasn't this caught during internal testing? I dropped a hint when I described how SNaN s work:
You have to ask the processor to raise an exception Read More......(
read more)

Written by The Old New Thing : Code on July 3rd, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Code and Contributors.
A colleague of mine related to me this story about uninitialized
floating point variables.
He had a function that went something like this,
simplified for expository purposes.
The infoType parameter specified which piece of
information you're requesting, Read More......(
read more)

Written by The Old New Thing : Code on July 2nd, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Code and Contributors.
A customer needed to generate an 8-byte unique value,
and their initial idea was to generate a GUID
and throw away the second half, keeping the first eight bytes.
They wanted to know if this was a good idea. No, it's not a good idea. The GUID generation Read More......(
read more)

Written by The Old New Thing : Code on June 27th, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Code and Contributors.
It's great when you have a tool to make programming easier,
but you still must understand what it does or you're
just replacing one set of problems with another set of more subtle
problems.
For example, we discussed earlier the importance of knowing when Read More......(
read more)

Written by The Old New Thing : Code on June 23rd, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Code and Contributors.
Commenter Chris Becke asks how the common controls convert ANSI parameters to Unicode ,
since the common controls are Unicode internally. Everything goes through CP_ACP ,
pretty much by definition.
The ANSI code page is CP_ACP .
That's what ACP stands Read More......(
read more)

Written by The Old New Thing : Code on June 16th, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Code and Contributors.
There are many situations where you pass a structure to a function,
and the function fills in the structure with information you request.
In some cases, the function always fills in the entire structure
(example: GlobalMemoryStatus ).
In other cases, Read More......(
read more)

Written by The Old New Thing : Code on June 11th, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Code and Contributors.
This is really just a corollary to Why are DLLs unloaded in the "wrong" order .
Exactly the same logic that explains why DLLs are unloaded in the "wrong"
order also explains why they are uninitialized in the "wrong" order.
Once you understand the first Read More......(
read more)

Written by The Old New Thing : Code on June 9th, 2008 with no comments.
Read more articles on 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and Code and Contributors.
A customer noticed that if you add three to a process ID
and pass it to the OpenProcess function, it still
succeeds.
Why is that? Well, first of all, I need to say up front that the behavior you're
seeing is an artifact of the implementation and is not Read More......(
read more)

Written by The Old New Thing : Code on June 6th, 2008 with no comments.
Read more articles on 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and Code and Contributors.
In the suggestion box, Serge Wautier asked why accelerators for hidden controls remain active .
He's apparently rather insistent because he asked the question again a few months later .
Asking the same question multiple times reduces the likelihood
that Read More......(
read more)

Written by The Old New Thing : Code on June 2nd, 2008 with no comments.
Read more articles on 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and Code and Contributors.
Shell extensions that create worker threads need to call the SHGetInstanceExplorer function
so that Explorer will not exit while the worker thread is still running.
When your worker thread finishes, you release the IUnknown that you obtained to tell the Read More......(
read more)

Written by The Old New Thing : Code on May 28th, 2008 with no comments.
Read more articles on 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and Code and Contributors.
« Older articles
No newer articles