Flags constants and new version
-
I was responsible for this horror: Version 1.0 I had the following:
const DWORD ACCESS_NONE = 0;
const DWORD ACCESS_VIEW = 1;
const DWORD ACCESS_MODIFY = ACCESS_VIEW | 2;
const DWORD ACCESS_DELETE = ACCESS_VIEW | 4;
const DWORD ACCESS_ALL = ACCESS_VIEW | ACCESS_MODIFY | ACCESS_DELETE;
const DWORD ACCESS_ADMIN = ACCESS_ALL;I needed ACCESS_EXECUTE in the next version of the software. So I declared:
const DWORD ACCESS_EXECUTE = 8; //Execute may not need view
const DWORD ACCESS_ALL = ACCESS_VIEW | ACCESS_MODIFY | ACCESS_DELETE | ACCESS_EXECUTE;const DWORD ACCESS_ADMIN = ACCESS_ALL; Where is the horror? We promised the user that old databases and files will run without any changes.
Co-Author ASP.NET AJAX in Action CP Quote of the Day: It is the same Friday that blooms as a new enriching day with novelty and innovation for us every week. - Vasudevan Deepak Kumar
-
I was responsible for this horror: Version 1.0 I had the following:
const DWORD ACCESS_NONE = 0;
const DWORD ACCESS_VIEW = 1;
const DWORD ACCESS_MODIFY = ACCESS_VIEW | 2;
const DWORD ACCESS_DELETE = ACCESS_VIEW | 4;
const DWORD ACCESS_ALL = ACCESS_VIEW | ACCESS_MODIFY | ACCESS_DELETE;
const DWORD ACCESS_ADMIN = ACCESS_ALL;I needed ACCESS_EXECUTE in the next version of the software. So I declared:
const DWORD ACCESS_EXECUTE = 8; //Execute may not need view
const DWORD ACCESS_ALL = ACCESS_VIEW | ACCESS_MODIFY | ACCESS_DELETE | ACCESS_EXECUTE;const DWORD ACCESS_ADMIN = ACCESS_ALL; Where is the horror? We promised the user that old databases and files will run without any changes.
Co-Author ASP.NET AJAX in Action CP Quote of the Day: It is the same Friday that blooms as a new enriching day with novelty and innovation for us every week. - Vasudevan Deepak Kumar
the check:
if ((access & ACCESS_ALL) == ACCESS_ALL)
will fail on (even ACCESS_ALL) old files. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.