-
Content Count
3781 -
Joined
-
Last visited
-
Days Won
188
Posts posted by David Heffernan
-
-
var Counter: UInt64; -
My advice is to understand a problem before looking for a solution. At the moment it's clear that the problem still eludes you. Concentrate on that first.
-
Every time someone calls SameValue a puppy dies
-
3
-
1
-
-
It depends a bit on what your goals are. But if you want to test equality then you need to put the expected value into a single. That's hard to do in a compiler because delphi literal syntax doesn't allow to specify the type of a floating point literal. You could declare a typed constant of single type and compare against that.
-
19 hours ago, jesu said:Thanks for all the suggestions. I have the feeling that VCL should somehow protect events that can recreate controls. Something like
if Creating then ForceQueue incompatible operationsBefore reaching this conclusion, does there exist a clear diagnosis of the problem. That hasn't been shown here yet, so I'd want to understand the problem before trying to solve it.
-
1 hour ago, Typer2 said:It’s generally not advisable to change the font of a form or visual control directly from within an event handler like OnClick, especially for controls that are part of the form itself. Internally, setting Font.Name or Font.Size can lead to a call to CreateWnd, which may cause issues if it's done while Windows messages are still being processed for the same control—resulting in access violations like the one you're seeing in COMCTL32.dll.
This is incorrect. Changing font properties in an event handler is fine.
-
2 hours ago, DelphiUdIT said:It is not mine, I'm not a chemical tech. I only see the use of the "absolute" directive and ask if there is any issue (in assignement for example). By the way I have tested some uses case and i don't found any issue, it's like a normal array of records.
Like I wrote, I had know that there are other methods, I was only curious about "absolute" used in array of records.
Thank you all for your interest.
It has nothing to do with assignment. It's pretty rare for absolute to be useful. Pretend it doesn't exists, and you'll get a long way.
-
1
-
-
1 hour ago, DelphiUdIT said:I always use Assigned(...) hoping that one day or another it will solve all the situations (either nil or an invalid pointer) 🙂
It will never find invalid pointers, but that's not why Assigned exists
-
2 hours ago, Stefan Glienke said:where mass would be a number instead of a string
I think the use of string here is to allow encoding of indeterminate masses for elements with no stable isotopes, or something along those lines. Look at the items with mass surrounded by parens.
-
What are you trying to achieve here? As Stefan says, why aren't you declaring these as records to begin with? And why would you want to make anything here a variable. Seems like this area of Physics is pretty much fixed!
-
1
-
1
-
-
7 hours ago, pmcgee said:@Stefan Glienke do you distinguish between the terms 'anonymous method' and 'anonymous function'?
I have mostly heard the word 'method' being used for something like "procedure of object / function of object".It's the official name for them, as you can see from the documentation
https://docwiki.embarcadero.com/RADStudio/en/Anonymous_Methods_in_Delphi
-
On 11/24/2023 at 6:43 AM, robertjohns said:but on my system TOSVersion.ToString returns Windows 10
We've no idea what your system is. There are many versions of Delphi. We don't know what your app manifest is. These are both possibly relevant.
-
1
-
-
Whether or not you want to use asm is not relevant. It's what you do with it that matters.
I mean, exactly what you said above would apply equally if you wanted to write the code in pascal.
-
3 minutes ago, dummzeuch said:Maybe if you want to use ASM to access the parameter?
Why would [ref] be needed to use asm?
-
Is there any known use case other than the one demonstrated by FreeAndNil, namely to allow modification of a const param?
-
Is there any known use case other than the one demonstrated by FreeAndNil, namely to allow modification of a const param?
-
McAfee, like so many AV products, the cure is worse than the disease.
-
2
-
-
Isn't this a well documented file system for which there are multiple open source projects that you can use to support the documentation?
More generally, I'd advise you to put more effort into asking questions. Time spent describing what your problem is, what you already know, where you are blocked, etc. is effort you should spend if you want to get something in return.
-
43 minutes ago, alogrep said:Thanks to all.
No, the division by zero was an exampte (and a test I actually didi).
It is all exceptions (that are not handled)
The more critical one is when I set a table to an index name that does not esxist.
The app just exit, no wrnings.
Doesn't sound like it's not that exceptions aren't handled. App exiting is entirely different. How about the details we asked for.
-
Or maybe floating point exceptions are masked so there is no exception. We can't see your code, or know what version you use.
-
5 hours ago, baoquan.zuo said:I’d assumed this was common knowledge, but I should have spelled it out.
That makes a lot more sense.
Assumed it was common knowledge? I'm not so sure. I think there's still a big underbelly of Delphi coders that don't get this.
-
1
-
-
15 hours ago, Anders Melander said:That's a bit... unnuanced.
I thought it was helpful. Even though the "problem" is pretty obscure, and I haven't encountered it myself, it's a point of data that might come in handy some day.
My point is that it's behaviour that you don't ever need to know because the correct way to handle byte data is as, well, bytes and not text. So for sure there's an algorithm, but it's not one that anyone actually needs to know.
-
1
-
1
-
-
16 hours ago, Roger Cigol said:All good ! There is more than one way to skin a cat.....
This way is reliable and works
-
1
-
-
2 hours ago, Roger Cigol said:Of course there ARE times when the use of ANSI strings makes sense. One example is when sending data to/from an external device down an RS232 port where the external device uses a protocol based on simple ANSI text. We have many real world cases such as this (eg Eurotherm temperature controllers). The key point that @David Heffernan makes is that you should choose your types carefully to closely (or exactly!) reflect your needs. Time spent thinking carefully about your type selection will save you time in the long run.....
I mean, you work with strings and do TEncoding.ASCII.GetBytes
-
1
-
![Delphi-PRAXiS [en]](https://en.delphipraxis.net/uploads/monthly_2018_12/logo.png.be76d93fcd709295cb24de51900e5888.png)
Millisecond Counter
in Algorithms, Data Structures and Class Design
Posted · Edited by David Heffernan
I mean you didn't say any of this in your original post. Clearly you knew what your requirements were, but we can't read your kind!