Go Down

Topic: How does this "dot" notation work? [solved] (Read 668 times) previous topic - next topic

Nick Gammon

May 25, 2012, 01:21 am Last Edit: May 27, 2012, 02:24 am by Nick Gammon Reason: 1
I see some code like this in the USB firmware files (Descriptors.c):

Code: [Select]
const USB_Descriptor_Device_t DeviceDescriptor =
{
.Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},

.USBSpecification       = VERSION_BCD(01.10),
.Class                  = USB_CSCP_NoDeviceClass,
.SubClass               = USB_CSCP_NoDeviceSubclass,
.Protocol               = USB_CSCP_NoDeviceProtocol,

.Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,

.VendorID               = 0x03EB,
.ProductID              = 0x2067,
.ReleaseNumber          = VERSION_BCD(00.01),

.ManufacturerStrIndex   = NO_DESCRIPTOR,
.ProductStrIndex        = NO_DESCRIPTOR,
.SerialNumStrIndex      = NO_DESCRIPTOR,

.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};


I'm not familiar with the use of dots in this way (eg. .Header). A Google search doesn't seem to come up with much except the usual stuff about dots separating things (eg. Serial.print) or some references to Java or Objective C.

Can anyone point me to some explanation about what this syntax means?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Hmmm, looks like it is C99:

http://stackoverflow.com/questions/5052206/device-descriptor-in-lufa-what-kind-of-structure-is-this-inside-i-think-it
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up