Results 1 to 5 of 5

Thread: [RESOLVED] int against byte

  1. #1

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Resolved [RESOLVED] int against byte

    Hi, I need your help………

    byte and int are two data typed we used in programming.

    byte is 8 bits long and int is 32 bits long.

    Since that we can used int type variable instead of byte type variable without any effect to the application or code ( without worry about the resource used )

    And also todays' most of the PC's are 32 bits.

    If we used int instead of byte it will execute the code quickly?

    Is it used more resource than byte?

    I'm confusing with this …….
    Last edited by eranga262154; Aug 8th, 2006 at 12:24 AM. Reason: Incomplete

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: int against byte

    1- No, 2- No

    I don't know if you have looked into other sources before asking, but in most programming methodologies, bytes are used in arrays not in single "byte", because it'd be much easier and faster to process byte arrays (8-Bit) than to process an array of integers (32-Bit). especially when reading from IO, Http, ... etc, because it allows the CPU to process multiple bytes at the same time.

    Your right on the other hand, Even if a program uses a "for loop" from (0 to 5) we declare the var as "int" because on either way the processor will use a 32-bit register to handle the var
    Last edited by ComputerJy; Aug 8th, 2006 at 02:43 AM.
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Wink Re: int against byte

    Quote Originally Posted by ComputerJy
    1- No, 2- No

    I don't know if you have looked into other sources before asking, but in most programming methodologies, bytes are used in arrays not in single "byte", because it'd be much easier and faster to process byte arrays (8-Bit) than to process an array of integers (32-Bit). especially when reading from IO, Http, ... etc, because it allows the CPU to process multiple bytes at the same time.

    Your right on the other hand, Even if a program uses a "for loop" from (0 to 5) we declare the var as "int" because on either way the processor will use a 32-bit register to handle the var
    Thanks for your comment,

    I just want to know int type is easy to process without worring about resources used by the CPU, etc:

    Anyway thanks.....

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: int against byte

    When you are working with java you don't worry about the CPU, you're only concerned with the JVM, because that's your virtual "machine"...
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Wink Re: int against byte

    Quote Originally Posted by ComputerJy
    When you are working with java you don't worry about the CPU, you're only concerned with the JVM, because that's your virtual "machine"...
    Its ok,

    But I think we have to think about the resourses used by our application which are going to develop, Isn't it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width