This
&(ULONG){ HEAP_COMPATIBILITY_LFH },
is not a casting. It is a compound literal. It creates an object of the type ULONG
with automatic storage duration and initializes it with the value HEAP_COMPATIBILITY_LFH
. Then the address of the object is taken.
Here is a demonstrative program.
#include <stdio.h>
int main(void)
{
unsigned long *p = &( unsigned long ){ 10ul };
printf( "%lu\n", *p );
return 0;
}
The program output is
10
From the C Standard (6.5.2.5 Compound literals)
3 A postfix expression that consists of a parenthesized type name
followed by a brace enclosed list of initializers is a compound
literal. It provides an unnamed object whose value is given by the
initializer list.
You may imagine the definition of the compound literal the following way.
For example you may initialize a scalar variable using a braced list like
unsigned long x = { 10ul };
But a compound literal has no name. So this construction
( unsigned long ){ 10ul }
in fact looks like
unsigned long unnamed_literal = { 10ul };
^ ^
| |
( unsigned long ) { 10ul }
Pay attention to that in C++ there is no such a notion as the compound literal.