On 2/17/21 8:40 PM, Jacek Caban wrote:
On 17.02.2021 19:33, Rémi Bernon wrote:
@@ -116,6 +116,7 @@ static struct namespace global_namespace = { static struct namespace *current_namespace = &global_namespace; static struct namespace *parameters_namespace = NULL; +static statement_list_t *parameterized_type_stmts = NULL;
Sorry for not catching this earlier, but what's the reason for having this? Is for delaying specialization? It seems to me that you could just specialize the type as soon as it appears in 'declare' statement and avoid additional global list maintenance.
Thanks,
Jacek
Yes, this is because we need to delay the instantiation.
I don't remember precisely, but I believe it's because the parameterized types generate their UUIDs from a signature computed recursively from their type parameters.
The signature includes the types UUIDs among other things, but so it can only be computed after the declaration of the types that are passed as parameters, and not in the declare block which can work with the forward declarations.
FWIW MIDL also generates the parameterized types specialized interfaces at the bottom of the headers, I guess maybe for the same reasons.