[gmpi] Re: low level API - Abstract Factory summary

  • From: Mike Berry <mberry@xxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Mon, 07 Feb 2005 17:02:08 -0700

Jeff McClintock wrote:

Cheers Angus,

Looking good.  One query...

 > As a general point of coding conventions, I'd prefer to see all
 > functions having a result-code return type equivalent to unsigned long
 > , unless a particular function needs to
 > return a value in an absolutely speed-critical way.

So a function that 'gets' something would need to look like..

GMPI_RESULT GetFlags(int *flags){ *flags = 123456;};

..and be called like...

int flags;
GetFlags ( &flags );

i.e. it can't just return something, you've got to pass in a pointer-to-something.

That will work, but is a little awkward.  What do people think?


This is a basic side effect of COM, always returning a result instead of a value. It seems cumbersome at first, but it actually ends up leading to much more error checking (a good thing) and some better design (not always assuming calls succeed). And I don't think that there is an appreciable speed issue here, since we are talking about API calls here. API calls can't be inlines (they call into another module or process). So every API call should be assumed to have some intrinsic cost. Returning a result instead of directly returning a value should not add noticable overhead.



-- Mike Berry Adobe Systems

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: