Morning Discussion
by Chris Faylor, Feb 26, 2009 7:22am PSTThursday? Yeah, no problem. I can do Thursday.
Starting to get a bit excited about this weekend's Frisco/Dallas Shackmeet of laser tag, bowling, gelato and doom. Maarten and I are both flying in tomorrow afternoon, as to not miss a moment of the Saturday hijinks. It's my first Shackmeet. Please, be gentle.
In unrelated news, you can now snag Duke Nukem 3D on PC for a paltry $6.
Splinter Cell Blacklist co-op modes partially detailed
FIFA 14 on PC won't use Ignite engine
Ace Attorney Trilogy coming to iOS next week
Far Cry 3 editor jazzed up with Blood Dragon shinies
Epic Mickey 2 for Vita coming June 18



I tried searching on msdn/google but I couldn't find an answer for this; why can't static_cast upcast/downcast on double ptr's?
class A
{
};
class B : public A
{
};
int _tmain(int argc, _TCHAR* argv[])
{
B** ppB = NULL;
A** ppA = static_cast<A**>(ppB);
return 0;
}
says:
error C2440: 'static_cast' : cannot convert from 'B **' to 'A **'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
but
B* pB = NULL;
A* pA = static_cast<A*>(pB);
works.
Thread Truncated. Click to see all 20 replies.
However, "m_" for members is incredibly useful. I also use "k_" for constants, "g_" for global variables, and "s_" for file-scope static globals.
When there are multiple related variables, usually pointer/size pairs, I like to use a brief prefix to separate them, with "p" for pointer and "n" for number:
m_pEntries; // pointer to first entry
m_nEntries; // number of entries
I also use "p" and "pp" when I think there might be some confusion, eg. when a function works with both references and pointers.
"m_dwCounter" is wrong in the worst way ... typical Microsoft SDK naming. Nobody cares that it's a "dw". And naming the variable "Counter" is completely useless. If it counts Things, a better name is "m_nThings".
You must be logged in to post.