Gentoo Archives: gentoo-user

From: Jorge Almeida <jjalmeida@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] memset_s
Date: Fri, 10 Nov 2017 20:09:52
Message-Id: CAKpSnp+jw=Xdq7V4ZZDzdFb7GMTb+ES7Mxq2PwQH-EcVqBHhdA@mail.gmail.com
In Reply to: Re: [gentoo-user] memset_s by R0b0t1
1 On Fri, Nov 10, 2017 at 4:25 PM, R0b0t1 <r030t1@×××××.com> wrote:
2 > Hello,
3 >
4
5 >
6 > I'm having trouble finding the article again, but these functions look
7 > very similar to Microsoft's extensions to the C standard. There is a
8 > good case to be made that they are counterproductive.
9
10 Yes, it looks like it. No wonder, if it's MS inspired. But what I care
11 about is the fact that it's not optimized away, not the boundaries
12 checking stuff. It's hard to believe that it is practically impossible
13 to clean up a buffer, unless one is willing to forego all
14 optimizations:
15
16 http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html
17
18
19 >> Of course, what would really solve the optimize-into-oblivion problem
20 >> is a pragma that when invoked on a particular block of code (maybe
21 >> only a function definition) would tell the compiler to do what the
22 >> programmer says rather than viewing a function as a kind of black box.
23 >>
24 >
25 > This would probably be useful. It may be wise to reimplement important
26 > functionality.
27 >
28 No idea how difficult it would be to implement, of course. There might
29 even exist a C keyword for that. After all, the C standard states the
30 "as-if" rule, it might as well establish such an exception.
31
32 Cheers
33
34 Jorge

Replies

Subject Author
Re: [gentoo-user] memset_s R0b0t1 <r030t1@×××××.com>
Re: [gentoo-user] memset_s Jorge Almeida <jjalmeida@×××××.com>