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?
Is there any particular advantage in choosing one respect to others?
Thanks,
Giovanni
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
> 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.
Thank you,
Giovanni
Brian
"Brian Muth" <bm...@mvps.org> ha scritto nel messaggio
news:45698A77-F3B4-494C...@microsoft.com...
> Giovanni, I concur with Igor. If you want it scriptable, then use either 2
> or 4 (my own preference is 4). Otherwise, I'd use 1.
Thanks Brian.
In case of scriptable component, why do you prefer 4 instead of 2?
Is the intent more clear when using a SAFEARRAY (2) instead of a VARIANT
which is a SAFEARRAY (4) ?
Or, in case of scriptable component, would you just use VARIANT's everywhere
(e.g. also for scalar integer type, etc.)?
Using VARIANT's seems to me like giving a more "dynamic" look to the
component interface, but IMHO I would prefer making the intent more clear,
so using VARIANT's as few as possible.
Thanks,
Giovanni
Scripting languages access COM objects through IDispatch, so each
non-VARIANT parameter or return value is automatically wrapped in a
VARIANT. It only makes any difference to clients that access custom
interfaces (or dual interfaces via vtable methods).
- Jim
> Scripting languages access COM objects through IDispatch, so each
> non-VARIANT parameter or return value is automatically wrapped in a
> VARIANT. It only makes any difference to clients that access custom
> interfaces (or dual interfaces via vtable methods).
Thanks Jim!
Giovanni