Jump to content

Fritzew

Members
  • Content Count

    83
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Fritzew


  1. 14 minutes ago, dummzeuch said:

    I don't see how assigning the field as the last operation in the constructor would solve the problem of duplicate destruction. Yes, if there is an exception, the class' destructor won't free SomeInstance and leave that for the finally block. But what if there is no exception? Then the try..finally around the construction will free SomeInstance and leave a stale pointer to an invalid instance inside the class.

    Why using a finally here and not an except block?
    Then you will only free it if there is a Exception.  

    • Like 1

  2. Hello all,
    is the a working actual modbus tcp implementation around? 

    Got a new project to work on for a cnc.  To be honest I have never used modbus myself so I'm don't know


  3. There could be done a lot in the language:
    In Elements:

     

    case myControl of 
    	Button: writeln("Looks like a button!"); 
    	CheckBox: writeln("This one's a checkbox"); 
    	else writeLn("No ide what this is!?"); 
    end;

     

    or something like:

    var i: Integer;
    var s := case i of
        0: 'none';
        1: 'one';
        2: 'two';
       3..5 : 'a few';
      else 'many';
    end;

     

    I like it.
    If somebody is interested in what can be done look at 

    https://docs.elementscompiler.com/Oxygene/Language/

     

    Using Elements a lot these days, it is always a shock come back to Delphi....
    Not speaking about Lambdas.....

    Delphi:

    for item in List.Where( function(part : TPart): boolean
    begin
    result := part.isVisible;
    end
    ) do; 

    Elements:

    for each item in List.Where(part -> part.isVisible) do; 


     


     

    • Like 1

  4. Delphi 10.3.2

    This code will not compile!  

    Stripped down from a TestSuite for our codebase. 

    Can't believe it.

     

     

     

    program Project17;
    {$APPTYPE CONSOLE}
    {$R *.res}
    uses
      System.SysUtils;
    Procedure Test;
    var
      int32max: Int64;
    begin
      int32max := MaxInt + 1; //Error here
      writeLn(Format('Integer  %20d', [int32max]));
      writeLn(Format('Integer  %20u', [-int32max]));
    end;
    begin
      try
        Test;
        readln;
      except
        on E: Exception do
          writeLn(E.ClassName, ': ', E.Message);
      end;
    end.

     

    Error (in German)

    [dcc32 Fehler] Project17.dpr(13): E2099 Überlauf bei Konvertierung oder arithmetischer Operation

     


  5. 12 hours ago, stijnsanders said:

    Guys, are all of you missing this? Due to the Pascal calling convention, the first (plain!) argument of a function maps into the same register(s), so in fact this is valid and correct code. Though strictly I agree it looks weird and like as if in 'normal' cases the Value members aren't assigned to Result members. Bit in fact, they're already there! So what is actually needed is a 'type size limiting' cast, which is exactly what Result.x:=SmallInt(Result.x); is.

    You are completely wrong here.... 
    It will never work......

     

    procedure TestSmall;
    var
     lPoint : TPoint;
     sPoint : TSmallPoint;
    begin
      sPoint := default(TSmallPoint);
      lpoint.x := 255;
      lpoint.y := 255;
      writeln('lPoint.x: '+lPoint.x.ToString+ '  lPoint.y: '+lPoint.y.ToString);
      sPoint := TSmallPoint(lpoint);
      writeln('sPoint.x: '+sPoint.x.ToString+ '  sPoint.y: '+sPoint.y.ToString);
    end;

    Compile and run.......

     


  6. Found today in System.Types........

     

    class operator TPoint.Explicit(Value: TPoint): TSmallPoint;
    begin
      if Value.x < Low(SmallInt) then
        Result.x := Low(SmallInt)
      else if Value.x > High(SmallInt) then
        Result.x := High(SmallInt)
      else
        Result.x := SmallInt(Result.x);
    
      if Value.y < Low(SmallInt) then
        Result.y := Low(SmallInt)
      else if Value.y > High(SmallInt) then
        Result.y := High(SmallInt)
      else
        Result.y := SmallInt(Result.y);
    end;

    Useless and wrong Code...

     

    • Confused 1
    • Sad 1

  7. 40 minutes ago, Stefan Glienke said:

    It still baffles me that DXScene or VGScene were usable given the years it took FMX to properly work.

    The funny thing is, there was a OpenGl Layer for Windows working really well at this time. (I'm also a lifetime customer, my "lifetime" was 4 or 5 month.....). After the purchase the OpenGl part was dropped, not longer usable, and older Delphi not more supported. It was one of the worth purchase i have ever done.

    • Like 1

  8. 4 minutes ago, Dalija Prasnikar said:

    Without going into deep discussion about compatibility and other technical issues... AFAIK Marc Hoffman would rather drop dead than sell anything to Embarcadero... 

    Yes that is for sure........
    Remobjects shows what can be done with LLVM,  
    working a lot with Elements these days. It is amazing what they have done with the language!


  9. 2 hours ago, Dany Marmur said:

    There are several prjects/tools out there for that, mostly pricey stuff built on other stuff. Also check with TJoe when it comes to PDF handling.

    I Would also tend to @tjoe if it comes to Pdf Questions. I don't think you will find a more competent person if it comes to Delphi and PDF 
    https://uberpdf.org

    • Thanks 1
×