That needs some major indentation.
The code in question appears to refer to an array that you've created with new. Since I don't see any in that code (which is damn difficult to read because there's no line separation in that damn code), you'll probably need to give us more.
By indentation, I mean not stacking things up on the same damn lines. You could condense the entire program into one line if you wanted but it would be crap programming. There's no crime involved with not separating your code blocks into multiple lines; on the contrary it improves legibility by multiple orders of magnitude.
If there's no new in your prog I truly can't put my finger on it.
That doesn't work at all. sizeof does its job at compile time. sizeof("T") is not necessarily sizeof(T), but it will always be sizeof(const char *).
Hm.. "sizeof(typeid(int).name())" is allowed to return either const char* or const wchar_t*. I thought he is using this to distinguish between wide-character mode or not.
But then again, it would be both a pointer, so if at all, it would need a dereferrence. Like "sizeof( *typeid(int).name() )" but I tried and for my MSVC it seems always to be "const char*" - no matter whether its set to multi-byte, unicode or unset character encoding..
"sizeof(typeid(int).name())" is allowed to return either const char* or const wchar_t*.
Assume you didn't mean to leave sizeof there. name() only returns const char *.
UNICODE only affects Window API functions. More specifically, the size of TCHAR.
The reason for that line is to find out how many elements are in the array.
Assuming we have a 15 element int array:
sizeof(array);
That would return 60 since each int takes of 4 bits of memory. However, I'm not interested in how much memory it's taking, I just want how big the array is, thus I then divide it by 4
sizeof(array)/sizeof(int)
However, since I don't know that I'm working with an int, I use typeid().name() which returns int, char, double, ett.
So this line:
1 2 3 4 5
int size=sizeof(array)/sizeof(typeid(unknowType).name())
/*Is equivilent to either*/
int size=sizeof(array)/4
/*OR*/
int size=sizeof(array)/sizeof(int)