Skip navigation.
 
mlRe: #define issues
FROM : Andrew White
DATE : Mon Apr 18 05:54:51 2005

Suggestion - throw away the ugly hack macros and replace them with:

typedef double matrix_type;
typedef matrix_type matrix_row [COLUMNS];
typedef matrix_row matrix [ROWS];
   // Use double typedef because I find it clearer than
   // 2-D declaration.

Now either use:

matrix m;
m [r][c] = 1.7;

or, if you must preserve the function syntax,

(void) setvalue (
   matrix m,
   unsigned int row,
   unsigned int col,
   matrix_type value
)
{
   m [r][c] = value;
}

Then compile with a decent compiler option to optimise away the function call.


As written, you are just creating needless headaches.  This is fairly
normal when using CPP rather than what the language already provides.

--
Andrew White

--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.

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