Why integer and int32


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 11 123 ... LastLast
Results 1 to 15 of 155

Thread: Why integer and int32

  1. #1
    Michael Culley Guest

    Why integer and int32

    Why do we have both integer and int32 in VB? They seem to do exactly the
    same thing and are completely interchangable.

    --
    Michael Culley
    www.vbdotcom.com






  2. #2
    Paul Mc Guest

    Re: Why integer and int32


    G'day Michael.

    >Why do we have both integer and int32 in VB? They seem to do exactly the
    >same thing and are completely interchangable.


    They *are* exactly the same thing.

    I can see no *good anough* reason for keeping both, personally. Perhaps it
    is just that Integer has been in BASIC for so long that it is mainly due
    to inertia... If Integer was unchanged from VB6, then I would see the value.
    However since Integer is in fact now what Long was, breaking compatability
    with VB6, it really just serves as a source of occassional, mild, confusion.
    After all this time in .Net, still I muck up with Integer and Long sometimes.
    No big deal, just a small annoyance.

    Cheers,
    Paul



  3. #3
    Michael Culley Guest

    Re: Why integer and int32

    Yes, as dan appleman said, the biggest bug he sees with api calls is people
    defining integers as longs. Every time I have accidentally used a long, the
    IDE has warned me.

    --
    Michael Culley
    www.vbdotcom.com



    "Paul Mc" <paulmc@nospam.thehub.com.au> wrote in message
    news:3cb4da3f$1@10.1.10.29...
    >
    > G'day Michael.
    >
    > >Why do we have both integer and int32 in VB? They seem to do exactly the
    > >same thing and are completely interchangable.

    >
    > They *are* exactly the same thing.
    >
    > I can see no *good anough* reason for keeping both, personally. Perhaps it
    > is just that Integer has been in BASIC for so long that it is mainly due
    > to inertia... If Integer was unchanged from VB6, then I would see the

    value.
    > However since Integer is in fact now what Long was, breaking compatability
    > with VB6, it really just serves as a source of occassional, mild,

    confusion.
    > After all this time in .Net, still I muck up with Integer and Long

    sometimes.
    > No big deal, just a small annoyance.
    >
    > Cheers,
    > Paul
    >
    >




  4. #4
    Kathleen Dollard Guest

    Re: Why integer and int32

    Michael,

    Um, Integers are friendly and Int32 is right?

    Course, Integers are also evil

    Kathleen



  5. #5
    Ed Courtenay Guest

    Re: Why integer and int32


    "Michael Culley" <mike@vbdotcom.com> wrote in message
    news:3cb4d855@10.1.10.29...
    > Why do we have both integer and int32 in VB? They seem to do exactly the
    > same thing and are completely interchangable.
    >
    > --
    > Michael Culley
    > www.vbdotcom.com
    >


    Int32 is the underlying type in the .NET framework, whereas Integer is the
    'friendly' VB.NET name for it, in exactly the same way that 'int' is the
    friendly name in C#.



  6. #6
    vinay Guest

    Re: Why integer and int32


    "Michael Culley" <mike@vbdotcom.com> wrote:
    >Why do we have both integer and int32 in VB? They seem to do exactly the
    >same thing and are completely interchangable.
    >
    >--
    >Michael Culley
    >www.vbdotcom.com
    >
    >


    Integer is a keyword in VB language while int32 is .NET framework datatype.
    And in VB.NET, VB Integer is traslated into int32. So in VB.ABCD (if it is
    there), Integer may get translated to int64 or float32 or something else.

  7. #7
    Willy Van den Driessche Guest

    Re: Why integer and int32

    I would say, int32 will always be 32 bit while integer may become int64 or
    int128 in the long run.
    --
    Van den Driessche Willy
    For a work in progress :
    http://users.skynet.be/wvdd2/index.html



  8. #8
    Karl E. Peterson Guest

    Re: Why integer and int32

    Now that that precedent is set, yep. No datatype is safe, anymore.
    --
    [Microsoft Basic: 1976-2001, RIP]


    "Willy Van den Driessche" <wvddwebcomments@skynet.be> wrote in message
    news:3cb67aa0@10.1.10.29...
    > I would say, int32 will always be 32 bit while integer may become int64 or
    > int128 in the long run.
    > --
    > Van den Driessche Willy
    > For a work in progress :
    > http://users.skynet.be/wvdd2/index.html
    >
    >



  9. #9
    dnb Guest

    Re: Why integer and int32

    "Integer" has traditionally meant the native word size of a h/w platform (8,
    16, 32, or now 64 bits) in my experience.



    "Michael Culley" <mike@vbdotcom.com> wrote in message
    news:3cb4d855@10.1.10.29...
    > Why do we have both integer and int32 in VB? They seem to do exactly the
    > same thing and are completely interchangable.
    >
    > --
    > Michael Culley
    > www.vbdotcom.com
    >
    >
    >
    >
    >




  10. #10
    Phil Weber Guest

    Re: Why integer and int32

    > "Integer" has traditionally meant the native word size
    > of a hardware platform (8, 16, 32, or now 64 bits) in my
    > experience.


    dnb: In C-based languages, "int" has been the size of the platform's native
    word. In MS BASIC dialects on IBM PCs and compatibles, "Integer" has always
    been a 16-bit signed integer, regardless of the underlying hardware or OS.
    ---
    Phil Weber



  11. #11
    dnb Guest

    Re: Why integer and int32

    I've never used the "C-base languages' as a measurement of "normal".

    Having my roots extend back to PDP-11 Macro-11 and even 8080's and 6502's
    before that, the concept of integer operations was a signed or unsigned
    value the width of the hardware's ALU.

    It was not until C came along that the confusion ran rampant: "WORD", 'int",
    "ptr' and dozens of other designations came along that all meant (most of
    the time) the same number of bits of storage, turning programming into a
    kind of Trivial Pursuit (qv: the off-ramp discussion on case-sensitivity on
    compilers).

    don


    "Phil Weber" <pweber@nospam.fawcette.com> wrote in message
    news:3cb87df6$1@10.1.10.29...
    > > "Integer" has traditionally meant the native word size
    > > of a hardware platform (8, 16, 32, or now 64 bits) in my
    > > experience.

    >
    > dnb: In C-based languages, "int" has been the size of the platform's

    native
    > word. In MS BASIC dialects on IBM PCs and compatibles, "Integer" has

    always
    > been a 16-bit signed integer, regardless of the underlying hardware or OS.
    > ---
    > Phil Weber
    >
    >




  12. #12
    Dan Barclay Guest

    Re: Why integer and int32

    On Sat, 13 Apr 2002 12:47:20 -0500, "dnb" <dnb@offramp.net> wrote:

    >"Integer" has traditionally meant the native word size of a h/w platform (8,
    >16, 32, or now 64 bits) in my experience.


    Sorry, but your experience is showing. The following integer sizes
    were used in MS Basic on various platforms.

    Platform Native size Integer size
    CP/M 8 16
    TRSDOS 8 16
    DOS 16 16
    Win16 16 16
    Win32 32 16

    Is there a pattern here?

    The size of Integer has always been 16 bits, and it has been
    documented that way.

    You may be confused by how other languages handle data types. C/C++,
    for example, define only the *minimum* size. For example "int" is
    defined to be *at least* 16 bits. It is not required to be "native"
    size but from what I can tell it generally is.

    Clue: Basic isn't another language, it's Basic. Well, I guess it's
    another language now... dunno what it is.

    Dan
    Language Stability is a *feature* I wish VB had!
    (#6)
    Error 51
    Error 3
    Error 9
    ....

  13. #13
    Kunle Odutola Guest

    Re: Why integer and int32


    "Dan Barclay" <Dan@MVPs.org> wrote in message
    news:iprlbus69bs1k0g9s4jh5cqh92be0c3e14@4ax.com...
    > On Sat, 13 Apr 2002 12:47:20 -0500, "dnb" <dnb@offramp.net> wrote:
    >
    > >"Integer" has traditionally meant the native word size of a h/w platform

    (8,
    > >16, 32, or now 64 bits) in my experience.

    >
    > Sorry, but your experience is showing. The following integer sizes
    > were used in MS Basic on various platforms.
    >
    > Platform Native size Integer size
    > CP/M 8 16
    > TRSDOS 8 16
    > DOS 16 16
    > Win16 16 16
    > Win32 32 16
    >
    > Is there a pattern here?
    >
    > The size of Integer has always been 16 bits, and it has been
    > documented that way.


    Sorry Dan but your experience may be showing too. "Integer" _used_ to be 16
    bits. It is now 32 bits.
    HTH.

    [And it is documented too ;-)]


    Kunle



  14. #14
    Jason Guest

    Re: Why integer and int32


    The answer is: because VB defines it that way.

    In VB6, an integer is 16 bits.

    This does not make much sense on modern machines, so VB7 dropped the 16 bit
    Integer and went to the 32 bit Integer. This is defined by the language,
    not the machine.

    Why is that important? When 64 bit machines arrive, an Integer in VB7 will
    be 32 bits across all machines, from WinCE machines, to PCs, to Itaniums.
    You will be able to run the same code on all three machines without having
    to worry about the difference in what the machine considers to be an "Integer."

    An Integer in VB will henceforth be 32 bits, until the next major overhaul
    of the language.


    "dnb" <dnb@offramp.net> wrote:
    >"Integer" has traditionally meant the native word size of a h/w platform

    (8,
    >16, 32, or now 64 bits) in my experience.



  15. #15
    dnb Guest

    Re: Why integer and int32

    I don't have my IBM 1620 programming card anymore, but I think that one
    might have been 12 bits. I know it was something weird (by today's
    standards, anyway :-)

    OR was that the PDP-8, sigh...





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center