Jump to content

Alexander Elagin

Members
  • Content Count

    198
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by Alexander Elagin


  1. History teaches us that nothing is new under the moon. Limiting the scope of a varable to the begin/end block was invented long ago, just have a look at the PL/I specification from 1964:

    Quote

    A begin block is a sequence of statements headed by a BEGIN statement (see Section 8.2) and terminated by an END statement (see Section 8.3). In general, you can use a begin block wherever a single PL/I statement would be valid. In some contexts, such as an ON-unit, a begin block is the only way to perform several statements instead of one. A primary use of begin blocks is to localize variables. Because execution of a begin block causes a block activation, automatic variables declared within the begin block are local to it, and their storage disappears when the block completes execution.

     


  2. 1 hour ago, Bill Meyer said:

     I have done some considerable work in small AVR devices using assembly language. More than sufficient for the tasks involved, and essential in some cases, as I was dealing with some relatively fine-grained real time issues. There are times when the absolute control is a very large benefit. Embedded processors, after all, encompass a tremendous range of possibilities, from incredibly simple to things as complex as an RPi.

    I also wrote a lot of assembly code a while ago, mostly for the 8051 family. Nothing beats a good assembler code when you need to get the most from the hardware. All those fancy higher level languages make it easier to write programs, but when all you have is 8K of program memory and 256 bytes of RAM shared with bits and register banks, then the real work begins :classic_tongue:

    • Like 1

  3. 4 hours ago, David Schwartz said:

    You cannot use Delphi to program, say, Raspberry Pi's and small embedded controllers. 

    As for embedded controllers - yes, plain C is the best choice. The new generations of coders may prefer Rust or C++ for this, current microcontrollers are way more powerful than a two decades old desktop PCs. But one can use a custom edition of Lazarus for bare metal programming of Raspberry Pi: https://ultibo.org/

    • Like 1

  4. On 12/2/2021 at 10:52 AM, David Schwartz said:

    Each CPU has two busses: an Address bus and a Data bus. The 8080 and 8085 had 8-bit busses for both. The 8086 and 8088 had a 16-bit Addr bus; the 80286 had a 20-bit Addr bus; and the 80386 was planned to have a 32-bit Addr bus.

    A small correction: 8080 has a 16-bit address bus and a 8-bit data bus (I am currently building a retro computer based on 8080A + 8224 + 8257 + 8275 + 8255A). 8085 also had a 16-bit address bus but it was multiplexed with the 8-bit data bus and required an additional latch for full address decode. Otherwise, your post was outstanding and very informative, thank you!

    • Like 1

  5. Delphi 10.1

    DevExpress VCL 20.1.5

    win32 / Debug configuration

     

    Blank application: 2 200 576 bytes
    Blank application with a single TdxPDFViewer:  15 368 704 bytes

    With an autogenerated toolbar: 21 126 656 bytes.

     

     


  6. I think that not much has changed in the structured storage implementation in the last two decades. If the library you are using works (and you have the sources) it will work until MS drops the OLE storage (or CFB, as they call it now) support. Anyway, it is all based on a simple set of COM interfaces (IStorage) and it would be easy to use them directly or write a simple wrapper if needed.

    Documentation for IStorage compound file implementation

    • Like 1

  7. 15 minutes ago, Lars Fosdal said:

    With XP no longer getting patches, I am not sure if that qualifies it as more stable?

    It is more stable in the configurations it is being used now. If nothing in the OS has broken thus far and no updates expected which can break something (as it regularily happens with "supported" OSes) I'd say XP machines will run until they break physically. Again, those computers are mostly not exposed to internet and are therefore not vulnerable to net exploits.


  8. 2 hours ago, Fr0sT.Brutal said:
    
    function TickDiff(StartTick, EndTick: Cardinal): Cardinal;
    begin
      if EndTick >= StartTick
        then Result := EndTick - StartTick
        else Result := High(Cardinal) - StartTick + EndTick;
    end;

     

    I was going to suggest this solution myself but then I thought it was too obvious 😉 and the code in System.Threading (which I quoted) was written by somebody more clever than me...


  9. But using GetTickCount64 in fact is a must for their code in the Threading unit which internally uses the milliseconds counter. As you know, the counter overflows every 49 or so days and some threads in your server application just hang waiting until the condition TThread.GetTickCount > FLastSuspendTick.Value + TThreadPool.SuspendInterval is fulfilled... I got hit by this myself. Of course, it mostly matters for the applications that run 24/7, but anyway using the 64 bit counter is a wise decision.

    • Like 2

  10. It is probably a semantic question. A ternary operator, by definition, is any operator that takes three arguments. The conditional operator ?: is just one of the set of such possible operators. It is easy to imagine, say, operator AAAND which takes three logical arguments and produces TRUE only if all of them are true, but the usefullness of such operator is not high. As for the textual representation of a ternary operator, it is a problem. While a binary operator naturally is placed between its arguments, it is worse in case of the ?: operator which in fact is written as two lexems divided by one of arguments. Were it written as a = ?: b, c, d it would be more strict. Maybe. Or maybe not.


  11. 2 hours ago, Lars Fosdal said:

    I sometimes wish I could call Delphi code in SQL style.

    
    Run(aText2='my text'); 

    i.e. specify individual parameter(s) and leave the rest as their default.

     

     

    In fact, Delphi supports named parameters, but only for automation (OLE/COM) objects. Like this (from http://www.blong.com/articles/automation in delphi/automation.htm):

     
      //An Automation method call, using two named parameters
      MSWord.Selection.InsertDateTime(
        DateTimeFormat := 'dddd, dd MMMM yyyy',
        InsertAsField := False);
      MSWord.Selection.TypeParagraph;
    

     

    • Like 2

  12. Have been using paid VMware Workstation since its version 5, no problems thus far. Easy to carry VM (on a eSATA or USB3.1 external SSD drive) between different computers, no problems with USB devices in the guest OS (I stick with W7 Pro as the guest OS). Graphics is a bit slower in the guest compared to the host, otherwise no speed differences.


  13. FMX might be good for mobile OSes, but not for heavy desktop applications. If one needs a Linux version of an existing VCL application with years of manpower already invested in its development, then going the FMX way means the total rewrite of the UI in the best case, or even some internal logic if the application does not have some ideal architecture (trust me, this is the most common case). Meanwhile, Lazarus clearly demonstrates that it is easy to make a crossplatform (Windows/Linux) desktop application with a single VCL-like codebase, and even convert an existing Delphi VCL project if it does not use complex third-party components. Alas, DevExpress suite is too complex and too Windows-rooted... I understand that Embarcadero decided to make its cross-platform framework from scratch thinking primarily about the mobile OSes. The Linux support arrived many version later, without any desktop support and only in the very expensive edition - as if they decided that Linux is something used on servers only. This is obviously not the case, but I think they have already lost the race to Lazarus. If only Embarcadero had decided to sublicense CrossVCL instead of FMXLinux... but they chose the wrong path.


  14. 47 minutes ago, Bill Meyer said:

    I had the opportunity to play a bit with Whitesmith's C on CP/M, and that persuaded me it would not be my future. I am not sure now how many floppies were involved, but I do remember that compiling hello world -- when it didn't crash -- took about 4 minutes.

    I remember compiling a (then) large FoxPro program with a text windows interface on PC XT. It even would not link at all - the linker crashed after a half of an hour - unless I replaced the linker with another (probably Watcom but I do not remember the detail) which could finally produce a working executable in just 40 minutes of heavy work. Those were the days...


  15. 33 minutes ago, DesadaptadoDimensional said:

    Just by curiosity, why almost all math operation worked, even Cos and Sin, without add in -uses- this System.Math in the list except Tangent?

    Mainly for the historical reasons. Turbo Pascal back in 1980's implemented a set of mathematical functions as a part of its standard (default) library which was implicitly used by any project (and still is in Delphi). This set included among others sin, cos, arctan but not tan, because it is simply sinus divided by cosinus. Now, decades later, Delphi significally extended the function list, which are now implemented in a separate unit System.Math. But the original functions are still available by default without using this module.

    • Thanks 2
×