[php-src] Issue #15094: Implementation of php_random_default_engine() is not C++ conformant

From: Date: Wed, 24 Jul 2024 18:53:14 +0000
Subject: [php-src] Issue #15094: Implementation of php_random_default_engine() is not C++ conformant
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247363@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15094 Author: cmb69 ### Description While trying to build [sqlsrv](https://pecl.php.net/package/sqlsrv) 5.12.0 against PHP 8.4.0alpha2, I've noticed https://github.com/php/php-src/blob/ce8ffedccf1e3514df37d608f6c80fa1f90782b9/ext/random/php_random.h#L168-L174 While designated initializers are a C99 feature, they are only supported as of C++20, and that appears to stretch compiler support a bit too far. Even worse, apparently the type cast isn't supported by MSVC (and maybe others) at all. Replacing that function definition with the following works smoothly: ````c static inline php_random_algo_with_state php_random_default_engine(void) { php_random_algo_with_state raws; raws.algo = php_random_default_algo(); raws.state = php_random_default_status(); return raws; } ```` Maybe there is a better solution. ### PHP Version PHP 8.4 ### Operating System Windows

« previous php.bugs (#247363) next »