#include <stdio.h>
int main()
{
unsigned char buffer[2] = {0, 0};
unsigned char* pByte = buffer;
*pByte = 1 + *pByte++;
printf("%d, %d\n", buffer[0], buffer[1]);
return 0;
}
% g++ --version
g++ (GCC) 4.0.1 (Debian 4.0.1-2)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% g++ q.cpp
% ./a.out
1, 0
% g++ q.cpp -O3
% ./a.out
1, 0
$ g++ --version
g++ (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ q.cpp
$ ./a.exe
1, 0
$ g++ q.cpp -O3
$ ./a.exe
0, 1
Posted by 슴갈
