Is it appropriate way to keeps the pointers in statically allocated array this way in C++?
void *data[1000];
Is the size of void* various on 32 and 64 bit machines?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s almost certainly absolutely not appropriate. Void pointers are pretty damn bad to begin with, and mix them with mutable static data, and you have something quite awful. A primitive unwrapped array of a magic number size on top of that, and I’m very glad that I don’t have that in my code. Of course, if you have to, then you have to, but in the incredible majority of new code, you won’t need anything like this.
Yes, the size of void* varies.