|
From: <or...@vp...> - 2004-07-09 14:24:33
|
Hi! Per Westermark wrote: > clock returns amount of time consumed by your process. Obviously the fi= rst > call to clock() should be zero since your program hasn't done anything > yet. >=20 > When you write empty for() loops - without any actual work in them - th= e > compiler optimization will completely remove your loop. The result is t= hat > your second call to clock() will be made immediately after the first ca= ll, > and give the value zero. This is a very interesting question, that I have been pondering on for so= me time now: what=20 can you assume, that is NOT going to be removed by compiler optimization?= This also arises=20 a serious security issue: if you say "clear this block of memory" but the= n you exit (or=20 similar), and actually never use that memory, will the compiler optimize = out the call, or=20 let it work? I would like to get some thoughts about this. Thanks. -- Greetings, Bal=E1zs |