Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: <3376:Oct2320:51:5590@kramden.acf.nyu.edu> Date: 23 Oct 90 20:51:55 GMT References: <2039@excelan.COM> <443@mole-end.UUCP> <1990Oct23.160116.10299@athena.mit.edu> Organization: IR Lines: 20 In article <1990Oct23.160116.10299@athena.mit.edu> tada@athena.mit.edu (Michael J Zehr) writes: > v = (a[i-1][j-1] + a[i][j-1] + a[i-1][j+i] + > a[i-1][j] + a[i][j] + a[i-1][j+1] + > a[i-1][j+1] + a[i][j-1] + a[i-1][j+1])/9; At a minimum I'd format this as v = (a[i-1][j-1] + a[i][j-1] + a[i-1][j+i] + a[i-1][j ] + a[i][j ] + a[i-1][j+1] + a[i-1][j+1] + a[i][j-1] + a[i-1][j+1])/9 which makes the j + i pretty obvious. Or a macro: #define A(b,c) a[i+(b)][j+(c)] v = ( A(-1,-1) + A(0,-1) + A(-1,+i) + A(-1, 0) + A(0, 0) + A(-1,+1) + A(-1,+1) + A(0,-1) + A(-1,+1) ) / 9 #undef A ---Dan