Jump to content

Marco V

Members
  • Content Count

    12
  • Joined

  • Last visited

Posts posted by Marco V


  1. On 3/23/2023 at 2:41 AM, Joseph MItzen said:

     Fine, I'll do it in Lazarus/FreePascal... guess what? They're limited to 255 characters too, which is bizarre. It's like they artificially limited themselves to match Delphi's limitations!
     

    (Free Pascal started life as a Turbo Pascal compatible compiler)


  2. On 7/12/2019 at 9:27 PM, 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.

    "Pascal calling convention" is a C foreign calling convention and unrelated to Pascal calling conventions (to be exact the Delphi register calling convention harks back to the Intel proposed CC for i686 and later). The fact that URL names 16-bit registers should have been a warning.


  3. 19 hours ago, David Champion said:

    I would prefer the Antlr grammar mainly because you can build and test the grammar as you go with the tools provided.

     

     

    The problem is that while that philosophy works well with reasonably clean languages that were designed top down using a grammar, it often doesn't work very well to retrofit to languages that weren't, or have seen decades worth of ad-hoc expansion with attempts at backwards compatibility.

     

    The delphi dialect is much more complicated then most people think. Note that if you get something working, you might want to try to push selected parts of the Free Pascal compiler test suite through it to iterate and harden the grammar against corner cases.

     

    But one of the problems of grammar driven solutions is that you need to duplicate many rules for each exception making the grammar unworkable at some point.

     

    Also, for something functional you often also need some form of semantic analysis, and Delphi has quite some implicit conversions (that then e.g. wreak havoc on e.g. overloading selection).

     

    • Thanks 1

  4. I have a handful of gotos in my code.  Mostly they have this form

    if compare1 then
    
       begin
    
           if compare2 then
    
            ...
    
           else
    
            goto label1
    
      end
    
    else
    
    ....
    
    label1:

    IOW jumping out of a multilevel IF block is faster than just letting it run its course. It is still active code, but I haven't revalidated the decision in ages (XE 1 or 3 times or so). Which is a problem with all low-level optimizations.

     

    The code searches for aggregates in an image (blob) so is quite RDS.
     


  5. Peter: that generally still works as of Delphi Seattle, I use it regularly. But it might have unicode issues due to working over a pansichar buffer, which would cause corruption when unicodestring is converted to array of ansichar. There is some MBCS support in textrec too but I have no experience with it, and probably would require updating devin/out.

     

    As so often, a workaround for that could be  setting the ansi codepage to UTF-8 per Windows 10-1805+ manifest, but that of course has very wide consequences. I don't have much experience with that in Delphi.

     

    Free Pascal has an unit of the same name and fucntion, but also supportsWriteStr(), which is available even in Delphi mode, so it is first order approx compatible with both Delphi and GPC for this.


  6. On 12/18/2021 at 11:53 AM, dummzeuch said:

    Not quite: You can write Windows device drivers with C. I doubt very much that this is possible with any Pascal based development tool.

    Free Pascal has a Native NT target (so NOT win32 layer), and it can generate such binaries. IIRC there have been experiments with Delphi too, but then using binary converters.

     

    Anyway, in questions like this that is language vs language, it is IMHO confusing to pull in things that not every C compiler can do either.

     

×