[php-src] PR #24628: Zend: add type polymorphism to add_{next_}index_TYPE() functions

From: Date: Sat, 24 Oct 2026 00:04:47 +0000
Subject: [php-src] PR #24628: Zend: add type polymorphism to add_{next_}index_TYPE() functions
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-39794@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/24628 Author: Girgias As it is ridiculous that we only have convenient APIs to add types for HashTables wrapped in zvals but not HashTables directly. But now that we require C11 it means we can rely on _Generic to exist. However C's _Generic is an infuriating mess to use as every single branch must be semantically valid even if it is discarded. Not at all confusing behaviour with terrible compiler errors, it took me a while to understand why the "obvious" ways of writing the generics did not work. Until I managed to stumble upon [1] (thank Kagi as Google/DDG have been useless) that explains the observed behaviour. It is possible for us to have parametric genericity because we are branching on pointers. The trick is to create dummy functions that take void* arguments and return a HashTable* rather than trying to use a macro. The C++ side is simple function overloading. [1] https://www.chiark.greenend.org.uk/~sgtatham/quasiblog/c11-generic/#bigbug

« previous php.git-pulls (#39794) next »