Jump to content

Is there a SAL for this?


MaryXYX
 Share

Recommended Posts

I have a method like:

void foo (__out char*& ptr)

{

ptr = NULL;

if (etc.)

ptr = something;

}

This gives a Prefast warning that the method might return NULL.

Is there a variant of "__out" that would mean:

"This method always returns a value in this parameter but the value might be NULL"?

I'm using "__out" rather than "_Out_" because the DDK in use doesn't understand "_Out_".

Link to comment
Share on other sites

Where SAL = ?

Is this following text:

- void foo (__out char*& ptr)

{

ptr = NULL;

if (etc.)

ptr = something;

}

Supposed to represent this as code ?


void foo (__out char*& ptr)
{
ptr = NULL;
if (etc.)
ptr = something;
}

Is the method used "like", or perhaps as you say "Something like" ?

Give a definition of how by using the different variables of "Like" and "Something Like" it may affect the outcome.

Explain the contextual structure of the text/code/argument, or whatever it may be in it's relationship to computing.

Link to comment
Share on other sites

I'm sorry but I don't understand your question. The method is passed a parameter which is a pointer to char, and it is passed by reference. There is more to the method than this, but the important part is that it supplies a pointer to one of a variety of strings depending on conditions. As it is possible for all of the conditions to be false, the pointer is initialised to NULL.

When the code as shown is compiled with the "Prefast" configuration selected, the following warnings are given:

"warning 28196: The result 'ptr' is 'NULL', which is inconsistent with the Results specified by the annotations."

"warning 6387: (PFD)'ptr' could be '0': this does not adhere to the specification for the function 'foo'."

The answer could be that whoever designed the SAL annotations did not understand the use of pass by reference, but I am hoping that is not the case.

Link to comment
Share on other sites

I'm sorry but I don't understand your question

Which of the questions (plural) do you not understand ?

Basically,can you explain the contextual structure of what you are doing in it's relationship to your present computing question ?

(i.e. put into context for the average home computer user what it is that you are trying to achieve in simple non-tech language , and why. - In that scenario many more people may actually learn something, which is the main objective of forums.)

In this way you may just hit lucky if someone knowledgeable amongst the readership turns their computer on, comes online and understands what you are trying to do, and on which piece of equipment.

Over to you to explain it all.

Good luck.

Link to comment
Share on other sites

I can't explain my use of the phrase "something like" because that phrase isn't in my post.

I can't put it into context for an average home user because the average home user doesn't understand the requirements of device driver writing.

I am building with VS 2008 9.0.30729.1 and DDK 7600.16385.1

The platform is a Windows 7 x64 Enterprise VM on VMware 7.1.1

Link to comment
Share on other sites

I am building with VS 2008 9.0.30729.1 and DDK 7600.16385.1

Aaaah ! You should have said that in the first place luvvy. Could have moved you on faster.

You will probably find you will be better off at source (Microsoft) than a general Windows forum under the "Miscellaneous Support" heading when dealing with specifics.

Try searching around over here:

http://social.msdn.m...category/vstest

http://social.msdn.m...n-US/categories

http://msdn.microsof...2(v=vs.90).aspx

Best of luck Mary.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy