The most important choice in writing is not what you say, it’s what you don’t say

Raymond Chen

“The most important choice in writing is not what you say. It’s what you don’t say.” Eric Gunnerson gave me that advice when I was writing my book. It’s sort of the writing version of “You don’t know what you do until you know what you don’t do.”

That’s why I’ll write

Of course, you probably wonder this magical pfl comes from. It comes from the Multilanguage Object in mlang.

  IMLangFontLink2 *pfl;
  CoCreateInstance(CLSID_CMultiLanguage, NULL,
                   CLSCTX_ALL, IID_IMLangFontLink2, (void**)&pfl);
  ...
  pfl->Release();

and not

The pfl variable we’ve been using is an interface pointer to the IMLangFontLink2 interface. We obtain this pointer by calling the CoCreateInstance function, asking for the object whose class ID is CLSID_CMultiLanguage (defined in the mlang.h header file) and specifying the interface ID (IID) of IID_IMLangFontLink2. The interface ID is a 128-bit value that uniquely identifies an interface; we use it here to specify that we wish to have access to the IMLangFontLink2 interface. Since COM uses explicit reference counting, we must remember to call the IUnknown::Release method when we are finished with the interface pointer. Each call to the IUnknown::Release method decrements the reference count by one, and when the reference count drops to zero, the object is destroyed.

  IMLangFontLink2 *pfl;
  CoCreateInstance(CLSID_CMultiLanguage, NULL,
                   CLSCTX_ALL, IID_IMLangFontLink2, (void**)&pfl);
  ...
  pfl->Release();

 

This is why I hate reading technical books. People think it’s better to write fifty words when ten are enough, that you should explain everything in excruciatingly tedious detail just in case there’s a reader out there who sees the word CoCreateInstance and says, “Gosh, I don’t know what that is, and I’m going to declare this book useless unless it explains everything from first principles.”

What next? “The left open brace begins a block of statements”?

0 comments

Discussion is closed.

Feedback usabilla icon