IssueRaiser

> For instance: there is no way to write a portable secure memset in portable C / C++.

> For instance: there is no way to write a portable secure memset in portable C / C++. Of course there is, you just use the volatile keyword. volatile guarantees that all read/writes have corresponding memory accesses and cannot be optimized away. It's not going to be as fast as memset but it's definitely portable and it won't be THAT slow. Then for platforms that have memset_s defer to that instead, otherwise fallback to the totally portable volatile + for loop.

Posted by kllrnohj on Jun 12, 2015, 9:40 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.6,000 issues0 comments

hackernews (EdTech)

> For instance: there is no way to write a portable secure memset in portable C / C++.

kllrnohjJun 12, 2015, 9:40 PM

> For instance: there is no way to write a portable secure memset in portable C / C++. Of course there is, you just use the volatile keyword. volatile guarantees that all read/writes have corresponding memory accesses and cannot be optimized away. It's not going to be as fast as memset but it's definitely portable and it won't be THAT slow. Then for platforms that have memset_s defer to that instead, otherwise fallback to the totally portable volatile + for loop.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue