9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] how to avoid a memset() optimization
@ 2002-11-14  6:53 Russ Cox
  2002-11-14 10:22 ` Douglas A. Gwyn
  2002-11-19  7:20 ` Roman V. Shaposhnick
  0 siblings, 2 replies; 27+ messages in thread
From: Russ Cox @ 2002-11-14  6:53 UTC (permalink / raw)
  To: 9fans

>   He doesn't need to know about volatile -- that's the whole point.
>   Once "experienced" programmer has set the buffer that way, the
>   less experienced just gets less chance to screw himself up

I'd still rather see it closer to the use that needs it.
If you're used to seeing secmemset then seeing
memset is a big red flag.  If you're used to seeing
memset with a volatile declaration, then you have
to seek out the volatile declaration, which might not
be anywhere near the call to memset.

This is a stupid argument anyway.  Volatile is a crock.
Here's another problem.  Suppose I'm worried that
leaking the processor flags at the end of my computation
might reveal something about the secret key.  I want to
clear them.  I could do something like:

	x = 0 & 0;

which in this particular case will clear the appropriate
flags.  But now the compiler comes along and optimizes
away the whole expression.  Where do I put my volatile
to make that stay?  Hmm?  The answer is not more crappy
qualifiers.  The answer is clearly dumber compilers.

Russ



^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [9fans] useful language extension, or no?
@ 2002-07-16 15:53 rob pike, esq.
  2002-07-16 15:05 ` Sam
  0 siblings, 1 reply; 27+ messages in thread
From: rob pike, esq. @ 2002-07-16 15:53 UTC (permalink / raw)
  To: 9fans

Saves you, what, 5 keystrokes?  Not too convincing.

-rob



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2003-03-04  9:44 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <sah@softcardsystems.com>
2003-02-15 14:30 ` [9fans] presentation preparation Sam
2003-02-15 19:37   ` Scott Schwartz
2003-02-15 19:48     ` andrey mirtchovski
2003-02-27  9:35       ` Ralph Corderoy
2003-02-28 18:44         ` [9fans] union directories Jack Johnson
2003-02-28 18:53           ` Russ Cox
2003-03-04  9:44           ` Adrian Tritschler
2003-02-15 20:49   ` [9fans] presentation preparation Richard Miller
2003-02-17 15:00   ` Russ Cox
2003-02-17 16:25     ` Fco.J.Ballesteros
2002-11-14  6:53 [9fans] how to avoid a memset() optimization Russ Cox
2002-11-14 10:22 ` Douglas A. Gwyn
2002-11-14 13:20   ` Sam
2002-11-14 15:20     ` Scott Schwartz
2002-11-14 15:26       ` Boyd Roberts
2002-11-14 15:34         ` plan9
2002-11-14 15:59           ` Sam
2002-11-14 18:57         ` Steve Kilbane
2002-11-15 10:51           ` Douglas A. Gwyn
2002-11-14 15:50       ` Dan Cross
2002-11-14 17:21         ` Douglas A. Gwyn
2002-11-14 18:51           ` Dan Cross
2002-11-14 15:50     ` Douglas A. Gwyn
2002-11-19  7:20 ` Roman V. Shaposhnick
  -- strict thread matches above, loose matches on Subject: below --
2002-07-16 15:53 [9fans] useful language extension, or no? rob pike, esq.
2002-07-16 15:05 ` Sam
2002-07-16 21:29   ` Steve Kilbane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).