Featured post
windows - Any reason I shoudn't add GUID validation to my Visual C++ program? -
in order make visual c++ program more robust i'm tempted insert checks guid
variables contain valid version 4 guids (and not left uninitialized):
guid guid; uuidcreate( &guid ); // many lines of code later... // following assert should not fire valid version 4 guids int data3 = guid.data3; assert( ( data3 >> 12 ) == 4 );
i'm sure guids either come within uuidcreate()
function or uninitialized variables (and latter i'd diagnose checks). concern microsoft change guid implementation in future versions of windows.
what other factors should consider decide whether such checks won't hurt? how guid implementation changes on future versions of windows?
my concern microsoft change guid implementation in future versions of windows.
deal it, if happens. no, seriously, worry implementation of integer
, microsoft decide switch .net datatypes , make integer
system-wide 4-byte value.
worry other things, if implementations changing, you'll have rewrite/change/fix program anyway.
edit: if understand right, you're worrying return value of function, not guid-structure itself. , mean @ moment can return either guid or uninitialized value, in future implementations might return 0-filled-guid?
in case stick first paragraph, worry if happens. @ moment function has defined behavior, work that. check uninitialized values , that's it. can't guess microsoft in future (hell, microsoft can't).
- Get link
- X
- Other Apps
Comments
Post a Comment