We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
针对SeerData类的私有变量m_data[1],在setData的调用memcpy(m_data, data, size);的时候,如果数据区不为null,这个size的大小应该不止1,memcpy会不会越界,这个地方没看懂,还是说是c++的高级用法,可以指导解释一下吗? (代码在SCHeadData.h文件里面)
The text was updated successfully, but these errors were encountered:
不会越界,它最小16字节的报文,所有数据区都会追加到16字节报文后面。
Sorry, something went wrong.
您好,是否有工程师支持您?您可以联系我们项目经理安排专门的工程师解答您的问题。github 上的问题可能回复的不及时
我看m_header是它最小的16字节报文,这个16字节我看就是机器人命令和标识数据区大小这些,这个我看明白了的。而这个m_data就是数据区的数组,但是我看代码里面这个数组大小定义的是一个字节(uint8_t m_data[1];),如果不是最小的16字节报文,数据区的大小肯定不止1个字节吧?
uint8_t m_data[1]; memcpy(m_data,data,size); 当size超过1时不会越界。这里的m_data可以看成是一个可变数组, m_header(16字节)报文+m_data[]构成了class SeerData类的总大小
No branches or pull requests
针对SeerData类的私有变量m_data[1],在setData的调用memcpy(m_data, data, size);的时候,如果数据区不为null,这个size的大小应该不止1,memcpy会不会越界,这个地方没看懂,还是说是c++的高级用法,可以指导解释一下吗?
(代码在SCHeadData.h文件里面)
The text was updated successfully, but these errors were encountered: