473,382 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

size of an integer depends on word lenght of an OS ?? IS IT

thats what i study in my theorotical books.

But i am confused and bowled!!!

Turbo C on XP.....sizeof int = 2

visual c++ on XP..sizeof int = 4

turbo C++ on XP ...size of int =4

gcc on linux size of int = 4



..... i am also confused with running turbo C on DOC is it because of that it is 2 bytes ??

Can anyone please ellaborate what exactly is word length of an OS
Sep 5 '07 #1
4 6635
dmjpro
2,476 2GB
thats what i study in my theorotical books.

But i am confused and bowled!!!

Turbo C on XP.....sizeof int = 2

visual c++ on XP..sizeof int = 4

turbo C++ on XP ...size of int =4

gcc on linux size of int = 4



..... i am also confused with running turbo C on DOC is it because of that it is 2 bytes ??

Can anyone please ellaborate what exactly is word length of an OS

Welcome to TSDN.
Actually, the size of Integer dose not depend on OS.
It depends on the environment the Language uses.
Means if the Runtime Environment uses X bit then the length of Integer will be X bit.
A system having X bit means the CPU Register length is X bit.
Look at some example,
Windows now uses 32 bit,DOS uses 16 bit and UNIX uses 32 bit also.

Kind regards,
Dmjpro.
Sep 5 '07 #2
JosAH
11,448 Expert 8TB
Welcome to TSDN.
Actually, the size of Integer dose not depend on OS.
It depends on the environment the Language uses.
Means if the Runtime Environment uses X bit then the length of Integer will be X bit.
A system having X bit means the CPU Register length is X bit.
Look at some example,
Windows now uses 32 bit,DOS uses 16 bit and UNIX uses 32 bit also.

Kind regards,
Dmjpro.
PL/1 can use any integer bitsize it wants. C has bit fields as well. It's hardware
that has a 'favourite' bitsize depending on the width of the databus. Most computers
use 32 bits or 64 bits wide databuses. Some of them even impose a bus boundary,
e.g. if the 'favourite' bus width is X bits, those X bits can only be read/written
on X bit address boundaries (b*n%X == 0 is a valid address, where b is the number
of bits in a byte (the smallest addressable unit)).

Languages however can define whatever they want; funny bitwidths need more
support than the 'favourite' bit width. Most of the time the general CPU registers
have the same width as the databus but even that is not always true; e.g. the
old 8088 had 16 bit wide registers but just an 8 bit wide data bus.

kind regards,

Jos
Sep 5 '07 #3
Welcome to TSDN.
Actually, the size of Integer dose not depend on OS.
It depends on the environment the Language uses.
Means if the Runtime Environment uses X bit then the length of Integer will be X bit.
A system having X bit means the CPU Register length is X bit.
Look at some example,
Windows now uses 32 bit,DOS uses 16 bit and UNIX uses 32 bit also.

Kind regards,
Dmjpro.

am still not clear!!
windows,DOS,UNIX are OS...hence it does depend on the number of the bits the OS use for integers!! ?? is it what u mean?
Sep 6 '07 #4
Savage
1,764 Expert 1GB
am still not clear!!
windows,DOS,UNIX are OS...hence it does depend on the number of the bits the OS use for integers!! ?? is it what u mean?
Yes,it does.
For example DOS is 16bit platform maked to work with procesors that have16bit architecture, so the size of int is 2bytes,on the other hand Windows ,since Win95, is a 32 bit platform maked to work with 32 bit procesor resulting in higher byte size for a int,which is now 4 bytes..

But,if you would try to get size of the int on 64bit procesor which works on 32bit platform,he will just emulate that he have 32bit architecture and size of int would be 4.Which proves that it does depand on OS

Savage
Sep 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

300
by: Ståle Sæbøe | last post by:
I am a bit curious about this. The graphic design people I work with say it is their preferred font for web pages. The reason being that it is "kinder" to the eye both in terms of shape and...
8
by: Shailesh | last post by:
One problem I've been wrestling with for a long time is how to use the C++ integral data types, vis-a-vis their size. The C++ rules guarantee that a char is at least 1 bytes, a short and int at...
11
by: aruna | last post by:
How is a character stored in a word aligned machine? Assuming on 64bit machine, 1 byte is reserved for a char, is it the case that only 1 byte is used to store the character and the rest 7 bytes...
14
by: Agoston Bejo | last post by:
Hi, sorry about the multiple posting, technical difficulties.... ----- What does exactly the size of the int datatype depends in C++? Recenlty I've heard that it depends on the machine's...
2
by: Dominique | last post by:
Hello, Im want to fix the width of a dashboard. I have a field which has a field (in this dashboard on the left part of my screen) which could be long and make the right side of the screen out...
6
by: marktxx | last post by:
Although the C90 standard only mentions the use of 'signed int' and 'unsigned int' for bit-fields (use 'int' at your own risk) and C99 adds _Bool. It seems that most compilers create the size of...
11
by: subramanian100in | last post by:
Given that the sizes of pointers to different data types(built-in or structures) can be different, though malloc returns a void *, it is assigned to any pointer type. The language allows it. From...
11
by: panther | last post by:
Hi, I need to read part of an integer by another variable. As example, if user enter 761120921, then, i = 761120921 j = 76 k = 112 l = 0921 as that. can you explain how do i acheive this?
6
by: joegao1 | last post by:
can anyone help here? I am working on an embedded system with a C-like programming language, therefore floating point operation is not allowed (because it is time consuming), and floating point...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.