|
-
Aug 8th, 2006, 12:23 AM
#1
Thread Starter
PowerPoster
[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
-
Aug 8th, 2006, 02:25 AM
#2
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
-
Aug 8th, 2006, 02:53 AM
#3
Thread Starter
PowerPoster
Re: int against byte
 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.....
-
Aug 8th, 2006, 11:11 AM
#4
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
-
Aug 9th, 2006, 11:04 PM
#5
Thread Starter
PowerPoster
Re: int against byte
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|