Page 1 of 1

DLC as int vs byte TPCANMsgFD

Posted: Thu 7. Jan 2021, 14:49
by ChololateIT
Hi,

I just saw that

Code: Select all

TPCANMsgFD.DLC
is defined as int while in the "classic" library it's a byte. Is this a bug and will be changed to byte?

Best regards

Re: DLC as int vs byte TPCANMsgFD

Posted: Fri 8. Jan 2021, 08:55
by K.Wagner
Hello,

no it is not a bug, it was intended so. As you can see the classic TPCANMsg structure has also a member LEN of type byte, and in the assembly is defined as int too.

Assembly:

Code: Select all

TPCANMsg.Length
Classic:

Code: Select all

TPCANMsg.LEN
The idea is to prevent the user for making castings by himself when working with the assembly. The assembly checks and sends the real data size to the underlying driver. This assembly is thought to do more than the classic library you know; even when it looks most same as the classic API, it could be extended to have other help functions and classes.