Oxidizer issue


(arturredzko) #1

Code lines like :

if ((count+=update) > BM.MaxCount) {}

if(--bits_until_update==0) update();

uint sym=value/(length>>=1);

are not imported correctly.

(marc hoffman) #2

Can you elaborate?

(Matt Robertson) #3

In .2359 this is what I get from the Oxidizer:

if (count := update) > BM.MaxCount then begin

if dec(bits_until_update) = 0 then begin

var sym: Integer := value / (length := 1);

The first assigns update to count rather than incrementing count by update. It should be something like

if (inc(count,update)) > Bm.MaxCount then ...

The second seems correct, but the Oxidizer gives the same result if the Java decrement operator is postfixed, i.e. if (bits_until_update-- == 0), in which case it should evaluate first and then assign.

The third does a right bit shift on length by 1 and assigns the value to length, but the Oxidized code simply assigns 1 to length.

(marc hoffman) #4

What’s the source language? From the snippet, this could be Objective-C, C#, Java… These kind of details matter :wink:

(Matt Robertson) #5

Since I use Oxygene for Android development, I forget sometimes that there’s more than just Java :slight_smile: The code I posted is Java.

(arturredzko) #6

Sorry for delay. My test code was C#. As Matt wrote such code either skip -= or – operator or insert inc/dec method that is not a function so cannot be used inside if clause.

(RemObjects) #7

Thanks, logged as bugs://81688

(arturredzko) #8

Other cases failing to convert you can test by trying to import C# as Oxygene files from project at https://github.com/shintadono/laszip.net .
I wonder how to fix error :
(E236) The "unsafe" modifier is required for this member
generated by translating code :
fixed(byte* pBuffer=buffer) {...}
Is unsafe still supported? Setting this flag in project option doesn’t help.

(Carlo Kok) #9

did you apply it to the method too? It needs to be on the method and in the project.

(arturredzko) #10

Ah, ok, now it works. I couldn’t find in this in doc. Why in the documentation most text styling related with “unsafe” is strike through?

(marc hoffman) #11

Documentation links that are struck out are still missing (ie being worked on). I apologize for the inconvenience, please see https://blogs.remobjects.com/2018/12/03/an-update-on-docs/ for an update on docs status. Unsafe is documented here: https://docs.elementscompiler.com/Oxygene/Members/Modifiers/