I am getting
g++ -O3 cache-l1-line.cpp -o cache-l1-line -lrt
cache-l1-line.cpp: In function 'int main()':
cache-l1-line.cpp:33:58: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat]
On my schools sunfire server … but not my my machine (Arch Linux). Why might that be. The line in question seems to be
printf("%d, %1.2f \n", i * sizeof(int), totalTime/TIMES);
Where i is defined:
for (int i = 4; i <= MAX_STRIDE/sizeof(int); i*=2) {
Whats the problem: full source on GitHub (link to revision)
In a 64-bit architecture expressions evaluate to 64-bit. Thus the proper specifier in that architecture would be %llu. Or conversely the expression should be casted to the width and type expected by the specifier %d.
EDIT: %llu instead of %lld — thanks for comment.
The expression (i * size_t) has different width and type in different architectures;
it’s (unsigned int) apparently in your i3 -system and (unsigned long long) in your i7 -system.