Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 08/15/24 in all areas

  1. I'm the original author of ICS software. I live in Belgium. There are a lot of contributors from a lot of countries. It is free software available only in source form. There is no company behind it. There is no ECCN nor ECN nor anything equivalent.
  2. ICS is a free component library used to build software applications, there are no export approvals for ICS, country of origin is the world, it contains code from multiple countries. Angus
  3. Cristian Peța

    ifthen strange return value !

    Compiler generated code can tell you if a variable is automatically initialized or not. I only wanted to point out that there is a method to check if an AI statement in this regard is true or not.
  4. Cristian Peța

    ifthen strange return value !

    I apologize, now that I read again was I wrote... but it was not my intention.
  5. David Schwartz

    ifthen strange return value !

    @bravesofts Tell me, if you go to a restaurant and they don't use a dishwasher, but instead simply wipe off dishes that people use and then use them again, what do you get served a drink in? You'd call it a "dirty cup". The cup or dish itself is there -- it's intact, it's complete, it's ready to go. But it's "dirty" -- its contents have not been set to "clean", initialized as it were, or NIL if it's an object. A variable in Delphi is a pointer. The assumption is that it points to an object somewhere. The language requires you to set it to a known initial state -- that's called INITIALIZATION. You can initialize it to either NIL or a valid pointer. Just leaving it uninitialized raises a compiler warning and usually leads to bugs if ignored. Declaring a variable as an object allocates a pointer and you don't know until run-time if what it's pointing at is a valid object or not. If you're lucky it throws a memory error; if you're unlucky, it goes off into the weeds because the data appears valid and eventually crashes on something unrelated, sending you down a rabbit hole that's unrelated to the REAL error. Your code is correct as far as Delphi's syntax and semantics go. Only it's not reflecting what you think it is. You're testing the contents of the pointer var itself, not the OBJECT. There's a built-in function called Assigned(x) that you should be using, not your own method, IsAllocated, because all Delphi knows is if the reference is NIL or not. If it's not, then it assumes it's a pointer to a valid instance of said object. It has no way of knowing if it's allocated or not, or even if it's valid or not. If your code NEVER INITIALIZES it, then local variables take on whatever value is in the memory allocated on the stack for that variable. You need to INITIALIZE IT BEFORE USING IT. Usually, that means you say: myVar := NIL; You can also say something like: myVar := TMyObject.Create(); In C++ you can specify initialization values for specific fields in the class IN THE DEFINITION so that when you DECLARE AN INSTANCE then those fields are AUTO-INITIALIZED. This is not possible in Delphi. Declaring a variable for an object does not create an instance of it; the value of that pointer is not auto-initialized -- you have to do it yourself, usually by setting it to NIL.
  6. That is an error message for a compiler bug. All you can do with it is report it to Embarcadero at https://qp.embarcadero.com. Start taking code out of your project until the error goes away, and then slowly reintroduce the removed code until the error returns. Try to isolate the most minimal code change that causes the bug, then include that detail in your bug report.
×