Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: CANMsg.h
- Revision:
- 3:4e42fdc0459f
- Parent:
- 2:2b8425b12d05
- Child:
- 4:5017a65ff423
--- a/CANMsg.h Thu Mar 29 18:56:19 2018 +0000
+++ b/CANMsg.h Wed Apr 25 11:47:00 2018 +0000
@@ -45,7 +45,8 @@
template<class T>
CANMsg &operator<<(const T val) {
MBED_ASSERT(len + sizeof(T) <= 8);
- *reinterpret_cast<T*>(&data[len]) = val;
+ //*reinterpret_cast<T*>(&data[len]) = val; // This used to work but now it hangs at run time.
+ memcpy(&data[len], &val, sizeof(T));
len += sizeof(T);
return *this;
}