Help with Compiler Errors when using "Designated Initializer"

I have completed a few small projects using 8-bit Arduino boards such as Uno and am trying to move to 32-bit boards (such as Adafruit Metro) for a more demanding project. In the course of trying to learn how to navigate the macros and structures in the libraries AND how to write understandable code, I came across a nice tutorial at: Accessing SAM MCU Registers in C - Developer Help

This example for initializing a clock generator (for a SAM D21-based board) seems to me to be very readable:

// Configure Generic Clock Generator 1 with XOSC32K as source
GCLK_GENCTRL_Type gclk1_genctrl = {
.bit.RUNSTDBY = 0, /* Generic Clock Generator is stopped in stdby /
.bit.DIVSEL = 0, /
Use GENDIV.DIV value to divide the generator /
.bit.OE = 0, /
Disable generator output to GCLK_IO[1] /
.bit.OOV = 0, /
GCLK_IO[0] output value when generator is off /
.bit.IDC = 1, /
Generator duty cycle is 50/50 /
.bit.GENEN = 1, /
Enable the generator /
.bit.SRC = 0x05, /
Generator source: XOSC32K output /
.bit.ID = 1 /
Generator ID: 1 */
};
// Write these settings
GCLK->GENCTRL.reg = gclk1_genctrl.reg;

However, the Arduino IDE always generates this type of error when I try to compile:

/Users/Jon/Documents/Arduino/Blink_5_Test1/Blink_5_Test1.ino: In function 'void setup()':
Blink_5_Test1:33:5: error: expected primary-expression before '.' token
.bit.RUNSTDBY = 0, /* Generic Clock Generator is stopped in stdby */
^

This compile error is not unique to this code snippet, but occurs every time I try to use the above example in my own code, so I assume that the above type of code is not "legal" within the Arduino IDE.

Questions: Is there an alternative way to achieve this type of readable code that the Arduino IDE will compile?

(I know how to achieve the result by directly writing bits to the register, but that's hard to read later.)

Where could/should I have discovered for myself about this kind of difference between the C++ language and the Arduino IDE?

Thanks for any help!

Jon

That example code is in C99, you are clearly compiling for standard C++ as that is what Arduino sketches
are.

This line does not look correct:

 .bit.RUNSTDBY = 0,        /* Generic Clock Generator is stopped in stdby */

Perhaps this was intended:

gclk1_genctrl.bit.RUNSTDBY = 0,        /* Generic Clock Generator is stopped in stdby */

Thank you both. I had missed the note on the site that I referred to that the example was for C99. MarkT, your answer caused me to read about the differences between C99 and C++ and to learn about constructors, which MAY be the right way to go about what I am trying to do. I am quite low on the learning curve for C++, having studied C more than 40 years ago. Lot's more reading to do, but I'm now pointed in the correct direction.