mercredi 29 novembre 2017

SAL Annotations: _Ret_maybenull_ for std::shared_ptr

Is it possible to annotate my smart pointer-returning function with SAL?

_Ret_maybenull_ std::shared_ptr<MyClass> getMyObject();

Gives me the warning

warning C6504: Invalid annotation: 'Null' property may only be used on values of pointer, pointer-to-member, array, or reference type: Function 'getMyObject' return. Actual type 'class std::shared_ptr'.

and not a single warning when writing this:

auto a = getMyObject();
a->foo();

Aucun commentaire:

Enregistrer un commentaire