Implicit casting for Nullable in XSharp 2.7
Posted: Tue Dec 01, 2020 9:31 am
Hi,
When migrating from XSharp 2.6 to 2.7, the code with implicit casting for Nullable variables stopped compiling.
Error: XS0266 Cannot implicitly convert type 'int?' to 'dword'. An explicit conversion exists (are you missing a cast?)
Code example:
/vo7 option enabled in project.
I was able to easily work around this problem by explicitly casting to DWORD.
But at the same time I want to clarify, is this an omission in the 2.7 compiler, relative to 2.6, or is it intended?
Best regards,
Leonid
When migrating from XSharp 2.6 to 2.7, the code with implicit casting for Nullable variables stopped compiling.
Error: XS0266 Cannot implicitly convert type 'int?' to 'dword'. An explicit conversion exists (are you missing a cast?)
Code example:
Code: Select all
LOCAL a AS BYTE[]
a := <BYTE>{ 1, 2, 3 }
LOCAL dwLength AS DWORD
dwLength := a?:Length
I was able to easily work around this problem by explicitly casting to DWORD.
Code: Select all
dwLength := (DWORD)a?:Length
Best regards,
Leonid