Here is the sample code that I ran on Visual Studio 2010:
#include <iostream>
int main()
{
int **p(NULL);
}
I get this error: error C2059: syntax error : 'constant'
But if I change int **p(NULL);
to int **p = NULL;
the above code compiles fine.
Checked this on GCC(Version:4.4.2) and both work fine. What am I missing here?
VC++ compiler seems confused about initializations of pointer to pointer ...
This works for example
int (**p)(NULL);
These don't
int *i;
int **p(&i);
int **o(NULL);
This works though
int (**p)(&i);
typedef int* intp;
intp *o(NULL);
etc... the pattern is initialization fails whenever two ** are present! I'd guess a bug! Someone from MSVC team might be able to confirm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With