Re: #define issues
Re: #define issues
- Subject: Re: #define issues
- From: Andrew White <email@hidden>
- Date: Mon, 18 Apr 2005 13:54:51 +1000
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.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden