64-bit puzzle

K

Karpov2007

The computer industry is changing, and 64-bit technology is the next,
inevitable step.
Look at sample.

int main(int, const char **) {
int a = -2;
unsigned b = 1;
int array[5] = { 1, 2, 3, 4, 5 };
int *ptr = array + 3;
ptr = ptr + (a + b); //Invalid pointer value on 64-bit platform
printf("%i\n", *ptr); //Access violation on 64-bit platform
return 0;
}

Do you know why this code does not work on 64-bit system? Do you
assured, what no similar errors founds in your code? Do you know other
typical errors reduce to down state C++ code on 64-bit platforms? If is
not present then visit site http://www.Viva64.com.
On this site you can find plenty information, devoted to programming of
64-bit systems. And also static analyzer Viva64 for detects multitude
64-bit portability issues.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top