Visual Studio Shoutout
Posted: Thu Aug 05, 2010 5:26 pm
I just installed my shiny new copy of visual studio 2010 and I noticed a new feature. At least I think it's new. Anyway, it's called Code Analysis. I turned it on and did a build of my code and it found the following error in my gdt::initialize function.
I looked up what Code Analysis is supposed to do, and it apparently checks code against a super strict set of rules and guidelines and emits tons of warnings to help find crazy typos (like the above). Awesome! (Now I've got a list of little things to fix on my warnings list )
I don't know how I ever would of found that typo. I probably wouldn't have come back and looked over my GDT code for awhile yet. Needless to say, Code Analysis is now on for all my projects. I haven't been this impressed with an IDE since I first started using one.
warning C6334: sizeof operator applied to an expression with an operator might yield unexpected results
Code: Select all
void gdt::initialize()
{
// Initialize Pointer
sm_pointer.limit = (sizeof(DESCRIPTOR) * GDT_MAX_DESCRIPTORS) - 1;
sm_pointer.base = (uint32_t)(sm_table);
// Initialize Table
memset(sm_table, 0, sizeof((sizeof(DESCRIPTOR) * GDT_MAX_DESCRIPTORS)));
}
I don't know how I ever would of found that typo. I probably wouldn't have come back and looked over my GDT code for awhile yet. Needless to say, Code Analysis is now on for all my projects. I haven't been this impressed with an IDE since I first started using one.