Jump to content

David Heffernan

Members
  • Content Count

    3711
  • Joined

  • Last visited

  • Days Won

    185

Posts posted by David Heffernan


  1. 9 minutes ago, chkaufmann said:

    So just that I get it right: Because my return value is an interface type, the compiler adds something like this as first statement of the method:

     

    Result := nil;

    Not quite. The default initialisation is outside the function. 


  2. You don't get this because the return type is a managed type and so is actually passed as an extra var parameter. So the variable is assumed to have been default initialised outside the function. 

     

    I'm not trying to defend the compiler design here. The handling of function return variables is a complete mess in my view. They should be passed by value from callee to caller. The whole hidden var param is a weird hack from the ancient past that should never have been done. 

     

     

    • Like 2

  3. 2 hours ago, Arnaud Bouchez said:

    It occurred to Eric at least with DWS. He actually monitored it before fixing it.
    Of course, he dealt with a language compiler and execution stack, but I guess a lot of other kind of projects may have very tiny objects - if the SOLID principles are properly followed.

    I'm not denying the existence of the problem.  I'm just putting up a flag to say that I believe that in a great many codebases you are very unlikely to encounter it.

     

    So, don't get to too stressed about this, and perhaps don't worry about trying to fix the problem unless you know for sure that you are affected by it.


  4. 16 minutes ago, Stefan Glienke said:

    Open cmd, type dcc32 it prints (almost) all parameters. You will find the -NS switch for namespace search path.

    So what you do is pass -NSvcl (probably there are some more needed such as Winapi - just take those that a new project in Delphi usually gets)

    That might make it compile, but you'll also need to specify any other options that are non-default.  And then update the code that invokes compilation any time you make a change to the project config being compiled. Why not let msbuild do it for you?


  5. As a programmer, you are aware of the issues around invalid data, missing data, etc. The client who provides the specification is often less aware of these issues, and their consequences.

     

    In terms of ethics, I would say that as a programmer it is your responsibility to raise the issue with the client. That's part of being a good professional. How the client responds to that is down to them. If they insist on ignoring invalid data, then that is their choice. But you should strongly advise them against that, and if they do insist, then document that this was their choice.

     

    In your case it sounds like the ultimate client is not being advised of this, and the culture in your organisation is to do what the client asks without questioning it.  That's a slightly different problem.  If the decision takers in your organisation are not receptive to best professional practise then there's only so much you can do.

    • Like 1
    • Thanks 1

  6. 40 minutes ago, A.M. Hoornweg said:

    Out of interest, which development system would you pick today?

    These decisions depend very heavily on what type of coding you are doing. In my case it's a numerical code, whose bottlenecks are floating point calculations. So runtime performance is highly important, and Delphi is very poor in this regard. 

     

    My working assumption is that C++ would be the right choice, at least for the numerical part of the code. But if and when we come to migrate then I'd need to spend a lot of time evaluating options, and I'd look beyond C++ too.

     

    This is not to say that I am a big fan of C++. 

×