This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Tue, Aug 28, 2012 at 4:44 AM, Paolo Carlini<paolo.carlini@oracle.com> wrote:Ok.Again, without context, I think this is not the point: random_device is meant to be just a simple high level wrapper around things like dev/random, inspired by facilities like dev/random on unix-like OSes. The brutal "fall back" we have now in place wouldn't be useful anyway for the uses Marc is talking about, because there is no way to provide a seed. That said, I can't check right now C++11 about random_device, I suppose Uli has already ;)I did read it. random_device is all about non-determinism. Of course I know that RNGs in some situations have to be repeatable. That's what all the engines are about. random_device isn't. You use random_device to seed an engine etc.
The spec says that if there is no way to create non-deterministic data the implementation may use a random number engine. "may" being to key.
But note that _GLIBCXX_USE_RANDOM_TR1, as *any* other such macro isn't supposed to be set by the user, definitely it's not. It's a configure-time macro. Thus, given your clarification above about "may", I think the issue here is whether normally people would like to see an abort, or the output of a fixed (no seed, that is, as we clarified already) deterministic engine as a fall back. In my opinion, having clarified the macro uses issue, the less bad solution is the deterministic engine. As a general maintainer of the library (that is not as a GNU/Linux maintainer) I would be more favorable to the abort if we had decently covered not just Unix-like systems but a few other systems, at least a bit of M$, etc.I perhaps didn't make myself clear as to what the big problem is. Depending on whether or not you define _GLIBCXX_USE_RANDOM_TR1 you get an object definition for 'random"device" which has the same name and mangling but has a different size. This means binary incompatibilities. Memory corruptions.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |