Skip navigation.
 
mlRe: #define issues
FROM : p3consulting
DATE : Sat Apr 16 10:25:21 2005

>
> #define setvalue(matrix, row, col, value) ( matrix[row+col] = value) 
> //roughly looks like this
>


row + col ?

0 + 3 = 3 + 0

and obviously is not what you want...

((row * 4) + col)
((0 * 4) + 3) == 3 and ((3 * 4) + 0) == 12

+

row and col being indices in an array
should be int not double...


(#define are not a good idea for this kind of application..., just an
opinion)


Pascal Pochet
<email_removed>
----------------------------------
PGP
KeyID: 0x208C5DBF
Fingerprint: 9BFB 245C 5BFE 7F1D 64B7  C473 ABB3 4E83 208C 5DBF

Related mailsAuthorDate
ml#define issues Aaron Boothello Apr 16, 09:44
mlRe: #define issues Justin Spahr-Summe… Apr 16, 10:09
mlRe: #define issues Aaron Boothello Apr 16, 10:13
mlRe: #define issues p3consulting Apr 16, 10:25
mlRe: #define issues Aaron Boothello Apr 16, 10:35
mlRe: #define issues Justin Spahr-Summe… Apr 16, 11:10
mlRe: #define issues Aaron Boothello Apr 16, 12:58
mlRe: #define issues Cameron Hayne Apr 17, 06:47
mlRe: #define issues Andrew White Apr 18, 05:54
mlRe: #define issues Michael Rothwell Apr 22, 04:37
mlRe: #define issues Steve Checkoway Apr 26, 07:04