Jump to content

Attila Kovacs

Members
  • Content Count

    1977
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by Attila Kovacs

  1. that won't help much as out parameter also taking inputs without any warnings, which is more screwed as the original problem
  2. A variable has to be initialized before being passed to a ref param, yes you have to decorate with "ref" or "out" -or whatever- the parameters at call: myproc(ref param1, out param2); <- this is the call, not the definition! you _have_ to set an "out" parameter before using it or before returning from the routine, even if you won't use that value (see my example) who knows what else... And I'm afraid this is because you can't just show hints for coding guidance as they will first disappear when you do what the compiler wants you to do. So it would be basically an error, like in c#. Am I right? Do we need that?
  3. but c# does not only giving hints, it is enforcing a lot of things. or is it possible to turn them off?
  4. Why is it relevant how c# works? It's completely different. won't compile: bool a(out int i) { if (1 != 2) return false; i = 43; return true; }
  5. This is more interesting to me, no hint, but I could pass values from b() to a(): procedure a(out sl: TStringList); begin showmessage(sl.text); end; procedure b; var sl: TStringList; begin //sl := TStringList.Create; //sl.Add('hi'); a(sl); end; I'd stick with "var" parameters and no superfluous hints...
  6. Why are you using "var" then? Why do you need the hint?
  7. OK, but it's not wrong passing uninitialized variable to a var parameter. Why the hint then?
  8. 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.
  9. It's not the compilers job to do code analysis for you?
  10. As a comment? 😉
  11. these are just your own patterns, no guarantee, it's just made up, also, calcX can be a one liner or a power-plant burner 🙂
  12. they have index you can inherit the accessors they have nice RTTI support, can be decorated the h*ll are you talking about, how should be a GetThis() more verbose about its implementation as a property?
  13. Attila Kovacs

    Class methods Polyformism

    this is it: class function TMaster.GetMasterId: integer; begin writeln(classname); // Result := GetChildID; { <= at this point I get an abstract error } end;
  14. Attila Kovacs

    Class methods Polyformism

    The compiler should read the docs and give some hint, if it's not already the case. At least at the "override".
  15. Attila Kovacs

    ISO8901: Week numbers and year

    There is no such thing in Delphi. You have to roll your own. Should not be that hard.
  16. Attila Kovacs

    Which option to use for a large batch of REST queries?

    I'm using "pipeline" for a multi downloader, with my "download" and "import" stages. It's really cool.
  17. Attila Kovacs

    TVirtualStringTree Columns

    Are the column indexes still the same? The tlte seems different. I'm not using icons so I never encountered such thing.
  18. Attila Kovacs

    SvcMgr and Event Logs

    in the Vcl.SvcMgr.pas / procedure TServiceApplication.Run; there are these two lines: if StartThread.ReturnValue <> 0 then FEventLogger.LogMessage(SysErrorMessage(StartThread.ReturnValue)); where LogMessage (windows ReportEvent()) gets a string parameter containing an error message and having 3 other parameters filled with default values: EventType=1, Category=0, ID=0. Now, every time this LogMessage is called, in the Event Logs I see an entry with ID=0 and the message is not the one passed to this method but the translated error message (to the windows' current language) of the ID=0. (Or some similar mechanism which I'm not aware of.) Like I'm having always: "Der Vorgang wurde erfolgreich beendet." ID = 0. But if I'm also passing the error code to LogMessage, like: FEventLogger.LogMessage(SysErrorMessage(StartThread.ReturnValue), 1, 0, StartThread.ReturnValue); then in the event viewer are the right messages. Also, the message parameter (the first parameter) will be inserted in those messages if there is a placeholder for that. Did something change since Windows NT or ist it a longstanding bug or do I miss something?
  19. Attila Kovacs

    SvcMgr and Event Logs

    btw. is there any default table provided by delphi?
  20. Attila Kovacs

    SvcMgr and Event Logs

    I believe you but I'm not dreaming.
  21. Attila Kovacs

    TVirtualStringTree Columns

    toAutoSpanColumns
  22. Attila Kovacs

    Profiler for Delphi

    @Anders Melander I've installed the VTune Profiler 2022.1.0/621966 and loaded an exe with a 31MB pdb and the hotspot analysis took about a minute. I think this was way slower back in the days you wrote the converter. Give it a try on an other machine.
  23. Attila Kovacs

    Profiler for Delphi

    I've downloaded the "latest" VTune Profiler, 2022.1 but it doesn't even touches the pdb file. Luckily I'm not using this app at all. edit: forgot to bind... stay tuned
×