Resources | Resources |




The IDL compiler supports the notnil keyword for qualifying interface references that must never be nil. The keyword is allowed anywhere that interfaces can be used to create references: within structs, within unions, within sequences, and as parameters. The keyword may not be used when creating a type alias with typedef, or in the inheritance specification for a child interface.

The following is an example of notnil:

interface ISignal; 
interface IStream 
 long OnDataAvailable(in notnil ISignal signal);
 long Clone(rout notnil IStream stream); 

Qualifying the signal parameter with notnil indicates that the signal passed to IStream::OnDataAvailable must never be nil. Similarly, the notnil qualification on the stream parameter indicates that a nilinterface reference must not be returned from IStream::Clone. In C and C++, notnil interface references are pointers that can never be NULL; see IDL interface references in C++ for details.