Jump to content

dummzeuch

Members
  • Content Count

    2634
  • Joined

  • Last visited

  • Days Won

    91

Everything posted by dummzeuch

  1. If the number of bits of an integer type matters, don't use Integer, use SmallInt, ShortInt, LongInt and Int64 (and Byte, Word, LongWord and UInt64). But yes, I see the problem. I am as culpable as anybody else of assuming Integer to be 32 bits and it has bitten me several times when I had to make some changes to an old Borland Pascal DOS program, where Integer is 16 bit. Since then I have been changing data types to (U)Int8, (U)Int16, (U)Int32 and (U)Int64 in records, where the size matters, whenever I come across them. I also add some assertion code as to the size of these records to the initialization section of the unit that declares them. (Yes, we use a lot of these records, the original software was written for DOS and used file of record for everything. We have switched to a self describing file format now that has a header describing the record structure (based on a mechanism described in "Tomes Of Delphi"). And before anybody asks: No, databases are not an option, even DBase is too slow.) But I digress ...
  2. I told ChatGPT to write a blog post for me thinking I might save some effort and finally get something useful out of it. Write a blog post about the Uses Clause Manager Expert in GExperts (Yes, I'm a lazy basterdâ„¢) It wrote a very convincing blog post on the topic which unfortunately was utter bullshit. None, I repeat: None, of the claims were true. So what did I do? I blogged about it.
  3. As soon as ChatGPT files a feature request for them ... đŸ˜‰
  4. dummzeuch

    Use-case question for average phone users re: file-sharing

    You realize that this doesn't answer the question, do you? As for "nobody": That's me then. I don't subscribe to any streaming services - I tried a few but they sucked - but I have got a sh*tload of music files on my computer and smartphone, most of them ripped from a CD years ago. Yes, I know that nobody buys CDs any more either. Back to the question: Sorry, I have no idea how to do that. I put my files on the phone using SyncThing (actually that is a convenient side effect of syncing my photos and notes to the desktop computer), but that's nothing the average user will even think about.
  5. This wasn't a mistake. This reflects the underlying platform. It might not have been a mistake, but it did make it harder to port code that assumed that Integer and Pointer have the same size from 32 bit to 64 bit. That's all I said.
  6. AI Researchers Warn of 'Model Collapse' As AI Trains On AI-Generated Content Who would have guessed?
  7. Unfortunately they (Borland? Or was it already Embarcadero?) decided, to keep Integer a 32 bit data type rather changing it to the same bitness as Pointer. So even with large address awareness this leaves a lot of room for compile and runtime errors. They even managed to make a mistake in the declaration of NativeInt in Delphi 7 to 2007 where it was 64 bit rather than 32 bit, even though the compilers were all 32 bit back then. OK, that's ancient history, but the fact that Integer is still 32 bit remains.
  8. That's not restricted to the Delphi IDE and packages though. Basically any DLL loaded into a process can do the same to that process. (I'm not sure about dotNET in that respect though.)
  9. dummzeuch

    'for i:= 0 to 4' does 6 loops when not in Debug mode

    Using the debugger works for most cases. But that (memory overwrite) is exactly the kind of bug where changing some compiler options might make the problem disappear because the memory layout changes. Of course the bug would still be there and simply waiting to bite you in the back.
  10. dummzeuch

    Why Should a C-Sharper Learn Delphi?

    David was talking about the platform, not the language. That would be the dotNet framework and the Delphi VCL/RTL. I can't really say whether that's true or not, I've never used dotNet and I'm unlikely to ever do that. (Unless after retirement I find that dotNet is a good solution for writing Linux programs for personal use and for fun, because I plan to ditch Windows when that time comes.)
  11. After trying to get anything useful out of chatGPT and wasting a lot of time to fix all the errors in the answer(s) I got, I am all for banning it from SO. I'm not sure it will work though. The dilution of web search results with plausible but wrong content generated by AI has already started and we will see a lot more of it. Of course there was already a lot of garbage on the web to start with, but now it has become much easier (-> cheaper) to produce it.
  12. dummzeuch

    App plugins

    Alternatively there are quite a few other scripting engines, like the one included in Fastreport (Pascal, Basic, C, if I remember correctly) or DWScript (formerly known as Delphi Web Script, but definitely not restricted to Web usage). Extending a program by such an engine mostly means to provide an interface for these scripts to access the programs data and optionally the UI. It can be quite challenging to determine what to expose and in which way.
  13. dummzeuch

    File Search

    You should specify the complete path to exclude: C:\Windows Not just Windows
  14. dummzeuch

    File Search

    This command also searches all subdirectories and only later applies a filter removing all entries that start with c:\Windows\. The function @programmerdelphi2k gave you is actually more efficient because it doesn't descend into the windows directory at all.
  15. dummzeuch

    File Search

    I think the word you're looking for is "skip". But yes that's exactly how to implement this.
  16. dummzeuch

    Delphi Debugging Help

    What exactly is it you are struggling with? Basically, you enable the debug options in the compiler options dialog, build and start your program from the IDE with F9. That's about it.
  17. dummzeuch

    Delphi Debugging Help

    If he qualifies for using it. An old, legal Delphi 7 license can still be used for anything, including professional programming. The CE license is very limited in what it allows.
  18. dummzeuch

    Optimization On or Off ?

    None of configurations create a map file by default.
  19. dummzeuch

    Use case or if else ?

    Unfortunately that would allow for yet another possible problem: What if two or more of these strings were identical? In that case multiple different DecodeExportXxx calls would be made: if aMessageType = 'EXPREG' then DecodeExportReg(vDoc, aCdn, aRequestCorrelation, aMessageText); if aMessageType = 'EXPREG' then // <== typo here DecodeExportAcc(vDoc, aCdn, aRequestCorrelation, aMessageText); When using "else if", in theory the compiler could create a warning in that case because the second if for that string could never be executed. But I doubt that the Delphi compiler actually is that good at analysing the code. if aMessageType = 'EXPREG' then begin DecodeExportReg(vDoc, aCdn, aRequestCorrelation, aMessageText); end else if aMessageType = 'EXPREG' then begin DecodeExportAcc(vDoc, aCdn, aRequestCorrelation, aMessageText); // <== possible compiler warning here end;
  20. I would like to have a set of some objects of the same class e.g. TEdit. Of course TEdit is not an ordinal type, so set of TEdit won't work. Is there some (generics?) container type that lets me Add Object instances to it, ignoring duplicates Check if an object instance is in the list Or even better lets me enumerate over all the object instances in the list So I can do something link this: var EditSet = TSet<TEdit>; ed: TEdit; begin EditSet.Add(Edit1); EditSet.Add(Edit1) EditSet.Add(Edit2); EditSet.Add(Edit4); if EditSet.Contains(Edit1) then Edit1.Text := 'Was in set'); if EditSet.Contains(Edit3) then Edit3.Text := 'Was in set'); // or even better: for ed in EditSet do ed.Text := 'Was in set'; end; I'd prefer using something ready made from the RTL, if it exists.
  21. dummzeuch

    Use case or if else ?

    I'm not sure how efficient the implementation of IndexStr is. Assuming it's a linear search, the case statement is worse on two accounts: 1. It more difficult to read and understand. 2. It's a bit less efficient. On top of that this implementation is error prone. If somebody inserts a new string rather than appending it to the array the indices in the case statement will all have to be corrected. It has only one advantage: It's less to type. And of course, it looks cleaner. Some kind of sorted list or hash table storing the strings and an enum value would be more efficient and less error prone (edit: in short: a dictionary). Of course that list must be initialized before it can be used, preferably only once. People who are used to languages that support case statements with strings will of course laugh at that code anyway.
  22. dummzeuch

    File Search

    @robertjohns please don't crosspost
  23. dummzeuch

    File Search

    'mytext.txt' is a file mask. A file mask does not need to contain wild cards.
  24. dummzeuch

    set of object instances

    This was about a set with at most 20 different entries, so performance would most likely not have been an issue (when I asked the question, it was only 5). I have solved the actual problem differently by now. A set is still involved, but not a set of object instances but simply a classical set of an enum.
  25. dummzeuch

    set of object instances

    What happens, when I add the same object twice? In a set, the duplicate will be discarded, but in a list?
Ă—