摘录


DESCRIPTION
     The memset_s() function copies the value c (converted to an unsigned char) into each of the
     first n bytes of the memory buffer whose starting address is given by s.

 It is a runtime-consrtaints violation if s is a null pointer, or if either of smax or n is
 larger than RSIZE_MAX, or if smax is smaller than n.  If there is a runtime-constraints vio-
 lation, and if s is not a null pointer, and if smax is not larger than RSIZE_MAX, then,
 before reporting the runtime-constraints violation, memset_s() copies smax bytes to the des-
 tination.

 In contrast to the memset(3) function, calls to memset_s() will never be ``optimised away''
 by a compiler.  This property is required by the following sentences in section K.3.7.4.1 of
 :

   Unlike memset(), any call to the  memset_s()  function  shall  be  evaluated  strictly
   according  to  the  rules of the abstract machine as described in (5.1.2.3).  That is,
   any call to the memset_s() function shall assume that the memory indicated by s and  n
   may be accessible in the future and thus must contain the values indicated by c.

点评

memset vs memset_s,这里有讲到!

原文

点击这里查看原文

其它

本帖内容由21QA云收藏工具自动生成,欢迎使用。

系统消息 若觉得内容不错,请点击左上角的"赞"图标,以优化网站的内容呈现。 另外,请及时验证注册邮箱,否则收不到21QA发出的红包。 官方Q群:250203055

asked 11 Dec '14, 13:56

%E5%8E%9F%E9%87%8E%E4%B9%8B%E7%8B%BC's gravatar image

原野之狼
1.9k9399116

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link: [text](http://url.com/ "title")
  • image: ![alt](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×885
×42

question asked: 11 Dec '14, 13:56

question was seen: 1,269 times

last updated: 11 Dec '14, 13:56

powered by O*S*Q*A

粤ICP备14040061号-1