• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: #define issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >#define issues (From: Aaron Boothello <email@hidden>)

  • Prev by Date: Re: setValue vs setObject (NSMutableDictionary)
  • Next by Date: NSBezierPath Glypths
  • Previous by thread: Re: #define issues
  • Next by thread: NSArrayController - Mutability lost?
  • Index(es):
    • Date
    • Thread