On 5/14/2014 12:05, Henri Verbeet wrote:
On 14 May 2014 08:26, Nikolay Sivov bunglehead@gmail.com wrote:
I don't think it makes sense to match msdn here regarding [optional] attribute, and that's why:
- 'optional' without 'defaultvalue' has no effect on headers, as far as I
can see;
- you can't mix 'optional' with required arguments like that, midl will
refuse to process such idl, optional arguments should be at the end of arguments list only;
I didn't try processing this with midl myself, but are you quite sure about that?
Yes, I tested that some time ago, and double-checked just now. Method like this:
--- HRESULT method([in, optional] float arg, [in] float arg2); ---
produces midl error 2090:
.\test_tlb.idl(44) : error MIDL2090 : optional parameters must come after required parameters : [ Procedure 'method' ( Interface 'Iiface' ) ]
The d2d1.h in the PSDK has these annotated with "_In_opt_", and presumably it's generated with midl.
These are manually added I believe, it's a part of so called annotation language or SAL (http://msdn.microsoft.com/en-us/library/ms182032.aspx). It's kind of markers for static analysers, this page says it's available starting VS 2005.