Possible Duplicate:
Difference between WIN32 and other c string
I got this code inside a small program to read a file
#ifdef WIN32
unsigned char *buffer = (unsigned char *)alloca((unsigned int)ui.length);
#else
unsigned char buffer[ui.length];
#endif
Can anybody tell me , why pointer used for win32 platform and character array for other platform?
The code intended to declare an array of length not known at compile time. It was likely written with the assumption that C++ compilers for Windows targets don’t support declaring such arrays (for example, Visual C++ doesn’t support that). So when compilation is done for Windows targets
alloca()function is used to achieve the same effect.