<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Thorsten Otto via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Do., 10. Feb. 2022, 13:00:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="font-family:'Noto Sans';font-size:9pt;font-weight:400;font-style:normal">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-size:9pt">- when constructing objects, ObjectGEM uses contructs like</span><br></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> new(PGroupBox, init(...)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> Such constructs are not supported by FreePascal, you have to assign the result to some variable (i think that is also an incompatibility to TurboPascal)</p></div></blockquote></div><div dir="auto"><br></div><div dir="auto">Assuming PGroupbox is declared as a pointer type to some object type it must either be</div><div dir="auto"><br></div><div dir="auto">GroupBoxPtr := New(PGroupbox, init(...)) </div><div dir="auto"><br></div><div dir="auto">Or</div><div dir="auto"><br></div><div dir="auto">New(GroupBoxPtr, init(...)) </div><div dir="auto"><br></div><div dir="auto">Anything else does not make sense. </div><div dir="auto"><br></div><div dir="auto">Cause in the variant you mentioned where would the allocated memory be stored? </div><div dir="auto"><br></div><div dir="auto">And yes, FPC is TP compatible here. </div><div dir="auto"><br></div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:'Noto Sans';font-size:9pt;font-weight:400;font-style:normal">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> <span style="font-size:9pt">- in a few places i got some strange warnings. For example the code</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">var tg,mo,jr: word;</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">tsetdate(((jr-1980) shl 9) or (mo shl 5) or tg);</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Gives:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Hint: (4035) Mixing signed expressions and longwords gives a 64bit result</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I have no idea why calculations with word (16bit) should give a 64bit result?</p></div></blockquote></div><div dir="auto"><br></div><div dir="auto">As the m68k port is a 32-bit one all (intermediate) calculations will be done in the native width (which is 32-bit). And if you have a signed/unsigned conflict it will escalate to the next width (which is 64-bit). </div><div dir="auto"><br></div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:'Noto Sans';font-size:9pt;font-weight:400;font-style:normal">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> <span style="font-size:9pt">- ObjectGEM uses the type "integer" for all vdi/aes parameters. Since that might be some implementation specific size, i started to replace it in a few places by "smallint", and doing a "type smallint = integer;" because PurePascal does not know that type. That turned out to be not so a good idea: although the types are identical, using "smallint" in the interface part and "integer" in the implementation is happily accepted by FreePascal, but PurePascal complains about a mismatch.</span></p></div></blockquote></div><div dir="auto"><br></div><div dir="auto">As long as you don't use mode Delphi or mode ObjFPC "Integer" is an alias to "SmallInt". And as you don't need any Object Pascal functionality in those units you don't need to enable it.</div><div dir="auto"><br></div><div dir="auto">And for users of the unit it's not relevant. They either need to use the correct type or the compiler will enforce the type conversion when calling functions anyway. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>