Re: Is there a difference between the C# "int" and System.Int32 ???

From: David Browne (meat_at_hotmail.com)
Date: 08/25/04

  • Next message: Joshua Frank: "Re: Telling when a method has finished"
    Date: Wed, 25 Aug 2004 15:10:52 -0500
    
    

    "C Newby" <can@democracydata.com> wrote in message
    news:%23AzthUtiEHA.1376@TK2MSFTNGP11.phx.gbl...
    > That is as I thought.
    >
    > But I was wondering ... so far as I remember, there was an intrinsic
    integer
    > type in Java. Is there any reason to think that the .NET implementation of
    > integers would suffer from performance problems (in comparison to Java),
    > even if only slightly? Or is the Java implementation in fact the same and
    > I'm just remembering it incorrectly?
    >
    > TIA//
    >

    Just to elaborate. . .

    Java has a strict distinction between primitive types and non-primitive
    types. You cannot create new primitive types, and you cannot cast a
    primitive type to an object reference.

    In .NET the type system containes both value types (which perform like
    primitive types, are passed on the stack and have value semantics) and
    reference types, which perform like Java Objects.

    In doing this, .NET gets better performance for things like Decimal and
    database-specific types which can be implemented as value types, and
    eliminates the annoying manual boxing in Java where each primitive type has
    an object wrapper type.

    David


  • Next message: Joshua Frank: "Re: Telling when a method has finished"

    Relevant Pages

    • Re: Generics are cool
      ... >> Tim Tyler wrote: ... >>> of Java. ... >>> never to have had primitive types in the first place. ... > that having everything be an object involves a performance hit is ...
      (comp.lang.java.programmer)
    • Re: newbie lost in strings......
      ... When you do int i = 0; you're declaring a variable i that holds the integer ... holds a reference to an Integer object which holds the integer value 0. ... In some cases, the variable is one of the primitive types (byte, char, int, ... The reason Java includes ...
      (comp.lang.java.help)
    • Re: "Real" Templates for Java?
      ... Java-like language that supports those features, ... avoid the casts nor the boxing/unboxing for primitive types. ...
      (comp.lang.java.programmer)
    • Re: Question of JAVA programmer to C# programmers
      ... > all primitive types in Java have the same semantics (aside ... with "fixed" length (as int, char, etc in C or Java), as opposed to ... In Java only variables for the primitive types can be of value types, ... while the rest are reference types. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: newbie lost in strings......
      ... not the Java sense) is usually an 8 bit ... > holds a reference to an Integer object which holds the integer value 0. ... > In some cases, the variable is one of the primitive types (byte, char, int, ... > i" both declare variables. ...
      (comp.lang.java.help)