String Reference Type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RN1

    String Reference Type

    If I am not mistaken, String is reference type. Can someone please
    explain me why is it reference type & not value type?
  • Jonathan Wood

    #2
    Re: String Reference Type

    A string can potentially contain a lot of data, and there's no telling what
    size a particular string might need to be.

    Therefore, not only does it make little sense to try and store a string in a
    register or on the stack, or anything else you'd do with a value type,
    strings have always been pointers in traditional languages.

    Why would it be a value type?

    --
    Jonathan Wood
    SoftCircuits Programming


    "RN1" <rn5a@rediffmai l.comwrote in message
    news:ed9a9b74-a8c9-47f4-ab87-38a6b3234b1c@n2 0g2000hsh.googl egroups.com...
    If I am not mistaken, String is reference type. Can someone please
    explain me why is it reference type & not value type?

    Comment

    • RN1

      #3
      Re: String Reference Type

      On Feb 10, 3:06 am, "Jonathan Wood" <jw...@softcirc uits.comwrote:
      A string can potentially contain a lot of data, and there's no telling what
      size a particular string might need to be.
      >
      Therefore, not only does it make little sense to try and store a string ina
      register or on the stack, or anything else you'd do with a value type,
      strings have always been pointers in traditional languages.
      >
      Why would it be a value type?
      >
      --
      Jonathan Wood
      SoftCircuits Programminghttp ://www.softcircuit s.com
      >
      "RN1" <r...@rediffmai l.comwrote in message
      >
      news:ed9a9b74-a8c9-47f4-ab87-38a6b3234b1c@n2 0g2000hsh.googl egroups.com...
      >
      >
      >
      If I am not mistaken, String is reference type. Can someone please
      explain me why is it reference type & not value type?- Hide quoted text -
      >
      - Show quoted text -
      So does it mean that data types that don't have a fixed size are
      reference types & those having a fixed size are value types?

      Thanks,

      Ron

      Comment

      • Jonathan Wood

        #4
        Re: String Reference Type

        No, I gave two issues: Variable size was one but the potential to be large
        was the other. This are two issues that are likely to make a type a
        reference type.

        --
        Jonathan Wood
        SoftCircuits Programming



        "RN1" <rn5a@rediffmai l.comwrote in message
        news:27f63246-cb59-45d0-880f-4bc7d1119ebf@u1 0g2000prn.googl egroups.com...
        On Feb 10, 3:06 am, "Jonathan Wood" <jw...@softcirc uits.comwrote:
        A string can potentially contain a lot of data, and there's no telling
        what
        size a particular string might need to be.
        >
        Therefore, not only does it make little sense to try and store a string in
        a
        register or on the stack, or anything else you'd do with a value type,
        strings have always been pointers in traditional languages.
        >
        Why would it be a value type?
        >
        --
        Jonathan Wood
        SoftCircuits Programminghttp ://www.softcircuit s.com
        >
        "RN1" <r...@rediffmai l.comwrote in message
        >
        news:ed9a9b74-a8c9-47f4-ab87-38a6b3234b1c@n2 0g2000hsh.googl egroups.com...
        >
        >
        >
        If I am not mistaken, String is reference type. Can someone please
        explain me why is it reference type & not value type?- Hide quoted
        text -
        >
        - Show quoted text -
        So does it mean that data types that don't have a fixed size are
        reference types & those having a fixed size are value types?

        Thanks,

        Ron

        Comment

        Working...