diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 62 |
1 files changed, 45 insertions, 17 deletions
@@ -56,20 +56,48 @@ the project. Hacking ~~~~~~~ -Like many Windows programs, Episode Browser uses Hungarian notation. -Following is a list of prefixes commonly used in the code base: - - lp = pointer ("long/far pointer") - b = boolean (BOOL, int) - i = integer - siz = size (size_t) - h = handle - l = long - w = "word" (WPARAM) - dw = "double word" (DWORD) - sz = zero-terminated string (char *) - wsz = ... wide string (wchar_t *) - tsz = ... tstring (TCHAR *) - sm = ... managed string (std::string) - wsm = ... (std::wstring) - tsm = ... (std::basic_string<TCHAR>) +Following is a summary of some coding conventions used in the project. + + ... HUNGARIAN NOTATION ... + + - p = pointer + - b = bool, BOOL, int (boolean value) + - i = integer + - h = handle + - hX = X handle (e.g., hWnd = HWND) + - l = long, LPARAM + - w = WORD, WPARAM + - dw = DWORD + - lvi = LVITEM + - sz = unmangaged, zero-terminated string (char *) + - wsz = ... wide string (wchar_t *) + - tsz = ... tstring (TCHAR *) + - str = ... managed string (std::string) + - wstr = ... (std::wstring) + - tstr = ... (std::basic_string<TCHAR>) + + ... TYPES ... + +Here are some general guidelines for choosing what types to use: + +1) Don't use Windows-specific types that "hide" pointers. +2) Where there is a Windows-specific type with the same name and + function as a standard type (e.g., CHAR = char), prefer the + standard type. +3) Otherwise, prefer the Windows-specific type when interacting with + the Windows API. + +For example, prefer... + + - char* over LPSTR + - char const* over LPCSTR + - LVITEM* over LPLVITEM + - int over INT + - DWORD over unsigned long + (when interacting with the Windows API) + +Note... + + - that the second rule above does not apply to BOOL, which should not + be replaced with bool, as BOOL is an integer that may have other + values than 1 and 0. |