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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:33:58+00:00 2026-06-07T03:33:58+00:00

I am some ‘memory allocator’ type code, by using an array and indexes rather

  • 0

I am some ‘memory allocator’ type code, by using an array and indexes rather than pointers. I’m hoping that the size of the index of the array is smaller than a pointer. I care because I am storing ‘pointers’ as integer indexes in an array rather than 64-bit pointers.

I can’t see anything in the Go spec that says what an array is indexed by. Obviously it’s some kind of integer. Passing very large values makes the runtime complain that I can’t pass negative numbers, so I’m guessing that it’s somehow cast to a signed integer. So is it an int32? I’m guessing it’s not an int64 because I didn’t touch the top bit (which would have been 2’s compliment for a negative number).

  • 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-07T03:34:00+00:00Added an answer on June 7, 2026 at 3:34 am

    Arrays may be indexed by any integer type.

    The Array types section of the Go Programming Language Specification says that in an array type definition,

    The length is part of the array’s type and must be a constant
    expression that evaluates to a non-negative integer value.

    In an index expression such as a[x]:

    x must be an integer value and 0 <= x < len(a)

    But there is a limitation on the magnitude of an index; the description of Length and capacity says:

    The built-in functions len and cap take arguments of various types and
    return a result of type int. The implementation guarantees that the
    result always fits into an int.

    So the declared size of an array, or the index in an index expression, can be of any integer type (int, uint, uintptr, int8, int16, int32, int64, uint8, uint16, uint32, uint64), but it must be non-negative and within the range of type int (which is the same size as either int32 or int64 — though it’s a distinct type from either).

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

Sidebar

Related Questions

Some time ago, I read that comparing version numbers can be done using the
Some people claim that using namespace std; is bad practice. Others say it's OK
Some clients experience an app crash directly when they launch it. Here's the code
Some time ago I've read an article on CLR, where author showed that if
Some simple code: - (IBAction)Up_Down:(UIStepper *)sender { double value = [sender value]; [NumDayLabel setText:[NSString
Some context for this code, what I am trying to do is create a
Some C or C++ programmers are surprised to find out that even storing an
Some time ago, I found a clever trick on stackoverflow that showed a way
Some of my column names in mysql are becoming rather large around 25 characters.
Some of my company consultants created multiple jasper reports (using iReports) which will be

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.