Hi Frank,

Frank Sch�nheit - Sun Microsystems, Inc. wrote:
  void setFacetValue( sal_Int32 nFacet, const Any& value )
  {
    if ( nFacet == ID_FACET_OF_TYPE_T )
    {
      T facetValue;
      if ( !( value >>= facetValue ) )
        throw IllegalArgumentException();
      ...
    }
  }

Here, it may be valid to pass a NULL reference, as long as it's of type
T (or a derived type). If no somebody passes a NULL-reference of type
T2, your proposal would imply that this value is accepted. However,
speaking strictly this is not allowed, as the given facet is of type T.

You could argue that effectively, it does not matter, because the facet
value is NULL afterwards, anyway. However, this would hide the error
made by the caller (passing an improperly typed value, no matter whether
NULL or not NULL).


But that same error *is* hidden, if a non-NULL reference to another type is passed (as long a the correct interface can be queried successfully).


So why detect a distinction for NULL reference that is not detected for others?

Ciao, J�rg

--
Joerg Barfurth              Sun Microsystems - Desktop - Hamburg
>>>>>>>>>>>>>>>>>> using std::disclaimer <<<<<<<<<<<<<<<<<<<<<<<
Software Engineer                         [EMAIL PROTECTED]
OpenOffice.org Configuration          http://util.openoffice.org


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to