Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/30/22 in Posts

  1. The new GExperts version still supports all Delphi versions back to Delphi 6 (with the notable exception of Delphi 😎 and even the Delphi 11 version is no longer in Alpha state (but it’s still beta, there will be glitches!). Support for per monitor DPI awareness should now work (in Delphi 11, and definitely better than in the IDE itself). There are even a few new features ... Read on in the blog post.
  2. Really? And what if the var in the sub-roc is passed further? How deep do you want the compiler work for you? What if the decision is based on a variant? Should the compiler evaluate every outcomes? How slow should be the compiler just for your entertainment? Buy TMS FixInsight, write unit tests and first of all, develop a coding pattern which doesn't even uses such pitfalls.
  3. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    You weren't lucky. You were unlucky. Lucky would have been if the error had shown itself immediately. No point analysing luck. Fix your code and move on.
  4. Sherlock

    did Sherlock left DP?

    I'm OK, guys, thanks for asking. Not Corona, but I've spent some time in the hospital nonetheless.
  5. Well, this is a private research-project about the EU Covid-certificates. I wanted to know how that stuff works and how the pieces are glued together. After a wild mixture of very interesting and also some nasty hours, I got it working. I also learned about new data formats that were previously unknown to me (hello "cbor"). Many different techniques come together here: decoding the data from Base45 (yes, forty-five) decompressing the result using the zlib-classes downloading external supplementary files using the http-components hopping from the formats "COSE" to "CBOR" to "JSON" using OpenSSL to extract and validate the digital signature against the official public keys All of this is now integrated in a small and fluffy Delphi program. This client reads the personal/medical data from the certificate displays the specific information for "vaccinated"-certificates "tested"-certificates "recovered"-certificates reads the digital signature from the certificate verifys that signature using the public keys from the official trust-list to detect fraud is clearly not an official application ready for production use anywhere Important: Some, but not all code ist from me. The unit "cbor.pas" comes from "https://github.com/mikerabat/DelphiCBOR", the interface to openssl comes from "https://github.com/Arvur/OpenSSL-Delphi". Just in case you're interested and want to try it: Download attached zip-archive. It contains the complete Delphi-project as well as the value-sets and trust-list (see #3). You need to get your hands on the openssl-libraries "libeay32.dll" and "ssleay32.dll" (not included in the downloads). These libraries must be located in the same directory as the executable. By default "Win32-Debug" is the output-path for this project. If you decide to switch to 64bit, you should provide the matching libraries. This program reads the trust-list and the so-called value-sets from external json-files. These files can be downloaded using the button "Download supplementary data" (button starts download, gives no feedback, you must restart the program afterwards). The trust-list contains the list of currently valid public-certificates. The value-sets contain the translations from IDs (values) to readable strings. All the json-files must be in the same directory as the executable - and that directory must be writable. The json-files from today are included in the download. You need - of course - an EU Covid-19 health certificate (vaccinated, tested or recovered). Take any barcode-scanner to translate the barcode into textual representation: You should get a string starting with "HC1:". Paste that code into the windows that opened after pressing "Scan certificate". CovDemo_06-Feb-2022.zip
  6. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    Because it has been designed correctly with ref, out and by value arguments handling the three different parameter semantics. C# is an example of how delphi should be, and the entire issue with this missing warning is because delphi is so badly designed in this area.
  7. Achim Kalwa

    OldCreateOrder and Delphi 11

    After reading your post, my first idea was to extend the GX_ExplicitFilterExpert to patch the TCustomForm.DefineProperties() method the same way as for TControl, then adding a WriteProperty('OldCreateOrder', True). But when TCustomFormFixOldCreateOrder calls "inherited DefineProperties", the code recursively calls itself, resulting in a stack overflow. So, I don't have any good idea to solve this problem 😞
  8. Yes, but that has always been the case, so there won't be any legacy code that passed an uninitialised variable to a ref parameter, and all of a sudden became invalid code. Delphi introduced the out parameter declaration "recently" (Delphi 5?), so there is legacy code that uses var rather than out. OK I change my vote to: This should emit a hint or a warning, because nowadays it's bad design and should be fixed ASAP.
  9. Easy: Value1 will be 4, since Value2 > 0 and therefore Value1 will be assigned Value2+1 = 3+1 = 4. So I guess your example has a bug. πŸ˜‰
  10. And other calls to that procedure might actually require an input value: procedure bla(var _Value1: integer; _Value2: integer); begin if _Value2 > 0 then _Value1 := _Value2+1; end; procedure blub; var Value1: integer; begin Value1 := 5; bla(Value1, 3); end; How should the compiler determine whether passing an uninitialized variable to procedure bla is a problem, without analyzing the procedure itself?
  11. If a variable is given to a method as var or out parameter that should be sufficient to rate that variable as initialized inside that method. If that would always issue a warning, you will have to make a redundant initialization just to make the warning vanish. I strongly reject this request.
  12. It's not the compilers job to do code analysis for you?
  13. I created a minimal reproducible example for this case. program TestInitialization; {$APPTYPE CONSOLE} procedure Test; procedure DoStuff(var a: Integer); begin if a = 0 then a := 1; end; var a: Integer; begin DoStuff(a); Writeln(a); end; begin Test; Readln; end. It's strange that the compiler doesn't show a warning W1036 Variable 'a' might not have been initialized. This is definitely an oversight.
  14. Dave Nottage

    Async dialog on android?

    I can understand that async dialogs are a concept that can be a challenge to embrace. Some time in the future we'll all be wondering why πŸ˜‰
Γ—