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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:08:10+00:00 2026-05-23T12:08:10+00:00

This week I’ve been working on some reflection-based code, and during unit testing found

  • 0

This week I’ve been working on some reflection-based code, and during unit testing found an unexpected condition: pointers are reference types. The C# code typeof(int).MakePointerType().IsClass returns true.

I checked in my just-arrived Annotated CLI Standard, and sure enough, pointers are clearly defined as reference types.

This was surprising to me, coming from a C++ background. I had just assumed that pointers would be value types.

Is there a particular reason why pointer types are reference types and not value types?

Update (clarification)

When talking about pointers and references, things often get confusing regarding the “pointer” and “pointee”. So here’s some clarification.

Types can be reference types or value types, but variables are a bit different. (Sorry, I haven’t had a chance to read through my CLI Standard, so the terminology and concepts may be wrong – correct me, please!)

Given this code (local variable concepts for reference types):

var x = new MyClass();
var y = x;

The variables x and y are not actually reference types, but they’re references to an object that is a reference type (MyClass is a reference type). In other words, x and y are not instances of the reference type; they only refer to an instance of reference type.

Given this code (local variable concepts for value types):

var x = 13;
var y = x;

The variables x and y are instances value types (or at least act like they’re instances).

So then we come to this code:

var i = 13;
var x = &i;
var y = x;

If the pointer type is a reference type, then this is how I interpret the statement x = &i:

  1. An instance of type int* is created, pointing to i.
  2. Since pointers are reference types, this instance is created on the heap (assuming that all reference types are placed on the heap, an implementation detail).
  3. x is a reference to this pointer instance.
  4. The pointer instance will eventually be garbage collected, just like other reference types.
  5. When y = x is executed, the reference is copied. Both y and x refer to the same instance of the pointer object.

Perhaps I’m completely wrong in this interpretation.

Coming from a C++ background, it would make more sense to me for pointers to be value types, so the statement x = &i is just assigning the address of i to the instance of the value type x, and y = x copies that address value into y. No “pointer object” would be created on the heap.

  • 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-23T12:08:11+00:00Added an answer on May 23, 2026 at 12:08 pm

    I haven’t seen a complete answer, so I’m closing this question down for now.

    I’m forced to conclude: pointers (e.g., int *) are actually value types; the fact that their Types return true for IsClass is a mistake in the specification. I suspect that no one has noticed this because getting the type of a pointer is a very rare operation.

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

Sidebar

Related Questions

We have been having some debate this week at my company as to how
I found the following mistake in my code this week: import datetime d =
this week I'm having problems logging in LinkedIn using ruby mechanize. My code is
Some background: I setup six blogs this week, all using Wordpress 2.92, installed with
I have been trying to get up to speed on Named Pipes this week.
Since this week noone has posted a code-golf challenge, I'll give it a try.
I'm writing code this week to dynamically change the color of images. As long
I was recently reading a question here (some time this week), which I can't
I've done a small mistake while coding this week-end. In the following code, I'm
This week I've been trying to learn Spring, JBoss, Maven, JPA and Hibernate 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.