[PATCH] D41316: [libcxx] Allow random_device to be built optionally

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 2 11:12:20 PST 2018


Quuxplusone added a comment.

@weimingz: Since your platform supports `srand(0)`, is it possible to look at how your platform implements `srand(0)` and "inline" that implementation into `random_device`? That seems like it would be more in keeping with the other ifdefs in this file.

I'm confident that constructing an instance of `random_device` MUST NOT actually call `srand`. (I'd like to say that it shouldn't even call `rand`.) Either of those calls would be observable by the programmer. But there is a precedent for e.g. `random_shuffle` making calls to `rand`.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41316





More information about the cfe-commits mailing list