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

  • SEARCH
  • Home
  • 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 7977551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:14:01+00:00 2026-06-04T09:14:01+00:00

I have the following procedure : procedure GetDegree(const num : DWORD ; var degree

  • 0

I have the following procedure :

procedure GetDegree(const num : DWORD ; var degree : DWORD ; min ,sec : Extended);
begin
  degree := num div (500*60*60);
  min := num div (500*60) - degree *60;
  sec := num/500 - min *60 - degree *60*60;
end;

After degree variable gets assigned the debugger skips to the end of the procedure . Why is that?

  • 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-04T09:14:02+00:00Added an answer on June 4, 2026 at 9:14 am

    It’s an optimisation. The variables min and sec are passed by value. That means that modifications to them are not seen by the caller and are private to this procedure. Hence the compiler can work out that assigning to them is pointless. The values assigned to the variables can never be read. So the compiler elects to save time and skip the assignments.
    I expect that you meant to declare the procedure like this:

    procedure GetDegree(const num: DWORD; var degree: DWORD; var min, sec: Extended);
    

    As I said in your previous question, there’s not really much point in using Extended. You would be better off with one of the standard floating point types, Single or Double. Or even using the generic Real which maps to Double.

    Also, you have declared min to be of floating point type, but the calculation computes an integer. My answer to your previous question is quite precise in this regard.


    I would recommend that you create a record to hold these values. Passing three separate variables around makes your function interfaces very messy and breaks encapsulation. These three values only have meaning when consider as a whole.

    type
      TGlobalCoordinate = record
        Degrees: Integer;
        Minutes: Integer;
        Seconds: Real;
      end;
    
    function LongLatToGlobalCoordinate(const LongLat: DWORD): TGlobalCoordinate;
    begin
      Result.Degrees := LongLat div (500*60*60);
      Result.Minutes := LongLat div (500*60) - Result.Degrees*60;
      Result.Seconds := LongLat/500 - Result.Minutes*60 - Result.Degrees*60*60;
    end;
    
    function GlobalCoordinateToLongLat(const Coord: TGlobalCoordinate): DWORD;
    begin
      Result := Round(500*(Coord.Seconds + Coord.Minutes*60 + Coord.Degrees*60*60));
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a modal dialog that is created with the following: procedure TFormCompose.createParams(var Params:
I have the following stored procedure ALTER PROCEDURE [dbo].Test AS BEGIN CREATE TABLE ##table
I have made the following code: procedure TForm15.Button1Click(Sender: TObject); var Bitmap1: TBitmap; im: TImageControl;
I have following procedure: procedure mayFailProc() as begin insert into t1 (id, val) values
I have the following code: procedure TCellBlock.GeneratePtoQ; var x,y: integer; i: integer; Change: cardinal;
I have the following SP: CREATE PROCEDURE [dbo].[sp_LockReader] AS BEGIN SET NOCOUNT ON; begin
I have the following code: procedure TForm1.FormCreate(Sender: TObject); var cpic: tcomponent; whichcol: integer; //
I have the following code snippet Procedure TFrm.Retrieve(mystring : string); var bs : TStream;
I have following stored procedure: CREATE PROCEDURE testProc(IN p_idProject INTEGER) BEGIN DECLARE nowTime DATETIME;
I have the following stored procedure: proc_main:begin declare done tinyint unsigned default 0; declare

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.