There is nothing wrong, put your notation as a suffix or a prefix, it doesn't make much difference. It is just that typically, you don't see DataChars, you see length or even n.
>> I loathe the hungarian naming convention. I dont want to parse variable names for meaning. I just want to read it, and instantly know. Also far easier to keep track of names without having to look them up, IMO. <<
Hungarian notation may not be the most readable naming convention and it is definitely not standardized among programmers but at least it is a naming convention.
Let's look at an example:
Code:
// Unix Opengroup - partial hungarian.
wchar_t *wcsncpy(wchar_t *ws1, const wchar_t *ws2, size_t n);
// Linux man - No hungarian
wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t n);
// Suggested hungarian with 6 char limit.
wchar_t *wcsncpy(wchar_t * szDst, const wchar_t * szSrc, size_t cchDst);
Is [i]n[/n] the character count of ws1, ws2, or the byte count, maybe a count of the stars over the North Pole at 3:00pm on 14 January 1923?
The linux version is better than the opengroup version, but I think my version is clearer than both.
Sure you could use another clearer naming convention, but you actually have to use it.
Unfortunately, for my argument the lstrcpyn prototype is not much better than wcsncpy:
Code:
LPTSTR lstrcpyn(LPTSTR lpString1, LPCTSTR lpString2, int iMaxLength);
So, hopefully we can agree, whatever naming convention you decide on:
- It only works if you actually use it.
- It has to be used well.
- It is not a replacement for a variable name (as in ws1).
[edit]I'm not sure if I've made a case for using a notation or I've just made a case for actually naming your variables - n is not a name![/edit]