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 373257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:17:26+00:00 2026-05-12T14:17:26+00:00

My plan is to make a function that retrieves the highest element of an

  • 0

My plan is to make a function that retrieves the highest element of an object, so to speak, the upper range of an array.In other words,I’m trying to get the the code of the function High().

What I have tried so far:

 function High2(var X):integer;
 begin
   Result:=Pbyte(Cardinal(@X)-1)^-1;
 end;

The function above should read the value(length) before the position of the first element in the object(array/string) and return it decreased by 1.However It doesn’t retrieve correct results neither on static nor dynamic array type.

How do I recreate the High() function in Pascal?

  • 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-05-12T14:17:26+00:00Added an answer on May 12, 2026 at 2:17 pm

    Not sure why you’d want to do that when Delphi already has a built-in High() compiler magic function, but OK, here goes.

    Static arrays: Can’t be done. No size information is stored at runtime since the size is known to the compiler and can’t change. High() just drops the necessary number into the code as a constant.

    Dynamic arrays: The compiler translates High to a call to DynArrayHigh in the System unit, which returns DynArrayLength – 1. DynArrayLength steps back 4 bytes from the start of the array (you’re only stepping back 1) and returns the length as an integer instead of a byte.

    Hope this is helpful. Why aren’t you just using High, BTW?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make an algorithm that will find the most efficient ordering for
I was having a horrible time today trying to get a query to perform
Okay, so here is what I'm trying to do. The user inputs a number.
Background: We have app a, b, and plan to add more apps into this
What I'm trying to do is quite simple but as a beginner I'm getting
Dynamic should be able to handle math without making me have to think about
I have been given this hypothetical problem: Osama returns from the dead and wants
I have a title on a blog goes like this Main Idea, key term,
I want to select a set of data into a single string, but I
I have two tables like this create table A_DUMMY ( TRADE_ID VARCHAR2(16) TRADE_DATA VARCHAR2(500)

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.