473,396 Members | 1,608 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,396 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 6637
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.