Re: [AD] C99 isms in test.c |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Hi all, comments below. Evert Glebbeek wrote:
While I don't want to argue about the relevance of this piece of code, I'd rather like to suggest to comment on the changes. I don't know how you guys handle commenting, but still, the x += and y+= lines of code do not comment on themselves and were added with some assumptions about the compiler in mind - something that would nicely go along with something like "Both x and y have to be changed so that a clever optimizer does not optimize away z".ct = 0;do {- z = fixmul(x,y); + z += fixmul(x,y); x += 1317; y += 7143; ct++;Why are these changes needed? Don't x and y change every iteration?Yes, but z is never used. A clever compiler will notice this and remove the `redundant' calculation. I haven't actually checked if it does this in this case, but I've seen it doing that in similar cases and I thought it best to err on the side of caution.Evert
Just my two cents ;-) Yours, David.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |