diff options
author | Martino Facchin <m.facchin@arduino.cc> | 2015-10-01 17:35:26 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@arduino.cc> | 2015-10-02 11:59:24 +0200 |
commit | 8cab209ef91cbda34bae8afa880f152c4f1473b0 (patch) | |
tree | 8dd9e1d4a4ded2f4de3c578d60502e0a3e6fda89 /libraries/HID/HID.h | |
parent | 66d3eabe42fa4590b111d3fe8442c0e556acedcd (diff) |
[PUSB] Fix static initialization order fiasco
For details see:
https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
Diffstat (limited to 'libraries/HID/HID.h')
-rw-r--r-- | libraries/HID/HID.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index 2cd0f4a..a7f5c68 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -93,6 +93,11 @@ private: uint8_t idle; }; +// Replacement for global singleton. +// This function prevents static-initialization-order-fiasco +// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use +HID_& HID(); + #define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) } #endif // USBCON |