Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8091925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:10:34+00:00 2026-06-05T20:10:34+00:00

Is the order in which parameters are calculated before a procedure is called defined

  • 0

Is the order in which parameters are calculated before a procedure is called defined in Delphi?

IOW, if I have this ugly code (found something like this in a legacy application) …

function A(var err: integer): integer;
begin
  err := 42;
  Result := 17;
end;

Test(A(err), err);

… is Test guaranteed to receive parameters (17, 42) or could it also be (17, undefined)?


Edit:

Although David’s example returns different result with 32-bit and 64-bit compiler, this (luckily) doesn’t affect my legacy code because Test(A(err), err) only stores an address of ‘err’ in the register and it doesn’t matter whether the compiler does this before calling A(err) or after.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:10:35+00:00Added an answer on June 5, 2026 at 8:10 pm

    The order of parameter evaluation in Delphi is not defined.

    As an interesting demonstration of this, the following program has different output depending on whether you target 32 or 64 bit code:

    program ParameterEvaluationOrder;
    
    {$APPTYPE CONSOLE}
    
    uses
      SysUtils;
    
    function SideEffect(A: Integer): Integer;
    begin
      Writeln(A);
      Result := A;
    end;
    
    procedure Test(A, B: Integer);
    begin
    end;
    
    begin
      Test(SideEffect(1), SideEffect(2));
      Readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does the order in which parameters are passed to a stored procedure affect the
I have a table called order which contains columns id , user_id , price
Suppose I have an order which has order lines and we have a multi-user
I have two entities say Customer and Order which exist on their own and
I have a column called menu_order which has no default value. When I select
I have code which will draw a graph that scales if the user attempts
I have an SQL Table named samples, defined like this: sampledate (datetime, 24 records
I know that C++ doesn't specify the order in which parameters are passed to
I have a List<Size> list1 which is from parameters.getSupportedPreviewSizes() I would like to sort
I have a search query which yields a resultset based on input parameters and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.