Re: IStream.Read()
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 9 May 2007 13:13:06 -0400
In this case, I would say that the documentation for the actual .NET
type is superceeded by the documentation for the IStream interface itself,
since the .NET type is nothing more than a representation of the COM
interface, and implementations should stick to the contract (in word and
spirit) defined by the COM interface, not what the .NET documentation
chooses to expose about the IStream interface.
Which brings up an interesting point. I agree, the current
documentation about the COM IStream interface indicates nothing about null
for that parameter. I would argue that the previous documentation trumps
the current documentation here because of the immutability of COM
interfaces. While immutability most certainly applies to the actual
physical structure of the interfaces, I believe it applies to the semantics
(the spirit) of the contract as well.
I can't imagine that MS, a company obsessed with backwards
compatability, suddenly decided, especially for an already published
interface as common as IStream, that all implementations are expected to
perform a null value check on that parameter and error when it was
previously published that they did not have to. I can see it going the
other way (initially saying that all implementations had to check for null,
then saying they could optionally check for null), but it doesn't make sense
in this case.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:D53A03E9-9B5F-4124-8EDA-5D4E31CEEAFD@xxxxxxxxxxxxxxxx
"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:uPeoBdlkHHA.4676@xxxxxxxxxxxxxxxxxxxxxxx
Read allows the last pointer passed in to be null. From the
documentation for IStream from the Platform SDK:
pcbRead
[out] A pointer to a ULONG variable that receives the actual number of
bytes read from the stream object.
You can set this pointer to NULL. In this case, this method does not
return the number of bytes read.
From the latest greatest Windows SDK docs:
pcbRead
[out] A pointer to a ULONG variable that receives the actual number of
bytes read from the stream object.
and from MSDN:
http://msdn2.microsoft.com/en-us/library/aa380011.aspx
http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.comtypes.istream.read.aspx
Note this:
For more information, see the existing documentation for
ISequentialStream::Read in the MSDN library.
You see, nothing about NULL to be allowed.
This :
http://msdn2.microsoft.com/en-us/library/ms890697.aspx
effectively talks about NULL to be allowed....
<snip
pcbRead
[out] Pointer to a ULONG variable that receives the actual number of bytes
read from the stream object.
You can set this pointer to NULL to indicate that you are not interested
in this value. In this case, this method does not provide the actual
number of bytes read.
/snip>
but this is about the ole32 implementation for Windows CE.
Willy.
.
- Follow-Ups:
- Re: IStream.Read()
- From: Willy Denoyette [MVP]
- Re: IStream.Read()
- From: Willy Denoyette [MVP]
- Re: IStream.Read()
- References:
- IStream.Read()
- From: Peter Larsen []
- Re: IStream.Read()
- From: Willy Denoyette [MVP]
- Re: IStream.Read()
- From: Nicholas Paldino [.NET/C# MVP]
- Re: IStream.Read()
- From: Willy Denoyette [MVP]
- IStream.Read()
- Prev by Date: Re: Webservice with optional parameters
- Next by Date: Re: 2 different threads checking on same variable scenario
- Previous by thread: Re: IStream.Read()
- Next by thread: Re: IStream.Read()
- Index(es):
Relevant Pages
|