Jump to content

Rudy Velthuis

Members
  • Content Count

    66
  • Joined

  • Last visited

  • Days Won

    2

Rudy Velthuis last won the day on February 4

Rudy Velthuis had the most liked content!

Community Reputation

23 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Off-topic, but actually, that is multi-posting. Cross-posting is posting to several newgroups on the same server, with one single post (i.e. the single post has multiple targets and a reply in one group will usually appear in the other groups too, unless the reply was specifically set up not to do that).
  2. Hypot takes the square root of sum of the squares, I guess (the length of the hypothenuse). But that is not necessary. It is enough to use Sqr(checkx - point.x) + Sqr(checky - point.y); Note that I use Sqr(), not Sqrt(). That will compare the squares of the distances, but that's fine too, as long as you know the square of the maximum distance. It is quite likely a lot faster, especially since you now only deal with integers again and don't need to take the square root.
  3. Probably because of the error in the code, the compiler got into an inconsistent state. In such cases, the only way to get rid of the problem is to restart the IDE.
  4. Rudy Velthuis

    CharInSet revisited

    Ad 1: The warning is correct. Both #$A and #$D are WideChar values reduced to AnsiChars. Ad 2: No, that doesn't mean it is resolved (I don't see any signs that we will get built-in Pascal sets 16-bit wide elements). Note that not C is reduced, only #$000A and #$000D. In such comparisons, if that is simpler, you will often see a set being reduced to a range. FWIW, instead of if A in ['A'..'Z'] then ... ; you can do: case A of 'A'..'Z': ... ; end; That is a little less convenient, but the range syntax lets you use all WideChar values, even the ones > #255. Ad 3: That is indeed weird. Even with optimizations on, you'll see the same. But this seems to be related to how LLVM handles DEBUG and RELEASE modes. It is well possible that the actual code in RELEASE mode (no-debug settings) is really optimized. But you can't see this in the CPU view. I say this because this kind of extremely ugly and uselessly complicated output can be seen from the Clang compilers too, in DEBUG mode. But as soon as DEBUG is off, you get extremely fast generated code. I just can't prove this yet. I managed to show this in the CPU view for a Clang-compiled program a few times, but sometimes that worked, sometimes it didn't. I can see that the code is shorter in RELEASE mode (48 instead of 64 bytes).
  5. Yes, indeed you did. I must have missed that, sorry.
  6. I assume that the structure of these $110000 values is thus, that there are many repeating structure, blocks and ranges, so I guess that for certain ranges, you only have to know parts of the values to know which types they are. I didn't look into the detail but I bet this is even described somewhere, in the Unicode documentation. Embarcadero didn't probably devise these lookups on their own.
  7. TRTTIContext doesn't have to be freed. To quote the help:
  8. Not much, as this is only one function. And it is more elegant than passing a pointer and type info. I would then make this function call a private function with the pointer obtained from the parameter and the typeinfo obtained from T. That way, there will hardly be any bloat. And if this function is not critical, you will never notice a difference.
  9. Rudy Velthuis

    Complete Boolean Evaluation

    Not necessarily mediocre, but short-circuit might sound like something went wrong. <g>
  10. Rudy Velthuis

    Complete Boolean Evaluation

    Wow, that was important for you, I guess. Yes, I am happy to use it. I just use it, and if it doesn't work, I find out soon enough. Just like I always forget the order of directives like virtual, stdcall, static, inline, overload, etc., so I just try out an order and find out if it is wrong. <g>
  11. Rudy Velthuis

    Complete Boolean Evaluation

    I am not so sure. If I remember correctly, in the very olden days, it was the only option (TP3 or some such -- memories about those days have become a little vague). Short-circuit boolean evaluation came later. Also: https://www.gnu-pascal.de/gpc/and.html: For such cases, GNU Pascal even knows the and then construct, to force short-circuit evaluation.
  12. Rudy Velthuis

    Pitfalls of Anonymous methods and capture

    FWIW, this is similar to the call-by-name problem (Jensen's device) in Algol 60. And similar problems can happen if people do: for I := 1 to 10 do begin MyRecord.Int := I; MyPlainTList.Add(@MyRecord); end; The entire plain TList is now filled with pointers to the same record, and that contains the value 10. <g>
  13. Rudy Velthuis

    Pitfalls of Anonymous methods and capture

    Hmmm... I knew I had read something like it before, but couldn't find it anywhere (in a meaning that made sense). The missing S did it.
  14. Rudy Velthuis

    How to switch condition position?

    I wrote"I think" but was not 100% sure anymore and hadn't looked it up. Your link confirms this: That is indeed what I thought to remember. It was pretty late though...
  15. Rudy Velthuis

    Pitfalls of Anonymous methods and capture

    Ah, thanks. I had seen something like it before, but when I googled, I found nothing useful. The extra S makes it easier to find too. <g>
×