32 bit machine

Discussion in 'Programmer's Corner' started by swty_todd, Feb 28, 2009.

  1. swty_todd

    Thread Starter Active Member

    Aug 3, 2008
    82
    0
    our textbook says that the output of a C program deepends on whether the machine is 32 bit or 16 bit. So i was wondering what that means and if today 16 bit machines are still used???
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Most PCs are still 32 bit, and will run in 16 bit compatibility mode.

    XP 64/Vista 64/Linux IA-64/AMD-64 run 64 bit and can run 32 bit in compatibility mode (with the right libraries in linux, and "lol" with Microsoft)

    There aren't many desktops running 16 bit anymore (DOS/Windows 3.11, Windows 95). Those pretty much went away around Y2k or so when XP came out, and hardware crossed the 1Ghz line with 32 bit. Embedded processors (PIC, Atmel, Intel) range from 8 bit to 64+ bits in DSP chips as well.

    The build target is set at compile/link time. Most PC/Windows compilers will build 32 bit code by default, some will build 64 bit. This is why there are many programs that ask if you are running 64 bit or 32 bit Vista or XP when downloading, since a package is built for each OS for best performance. It is rare for the exact same C code, more complicated than "Hello, World!", to cleanly build for different environments, you need many IFDEF constructs to use the hardware to the best advantage.

    Building a binary for a system that is different from what the current OS is running is referred to as "cross-compiling", usually referring to PIC programs, etc.
     
  3. Mark44

    Well-Known Member

    Nov 26, 2007
    626
    1
    For the sake of portability across a variety of processor architectures, the C programming language was designed to be architecture-agnostic. The size of an int wasn't specified, other than to say that it should be the size of a machine word, which is the size of registers. C compilers for 16-bit Intel processors such as the 8088 and 8086 and later processors on 16-bit operating systems used 16 bits to store an int value, and 32 bits to store a long. They also stored a short or short int in 16 bits.

    Later, when 32-bit processors and 32-bit operating systems became common, C (and C++) compilers were written so that a short was still 16 bits, but an int was now 32 bits, and a long was 32 bits.

    The state of things now is that there are a lot of 64-bit processors out there, and some of them are running on 64-bit OSes, so some C/C++ implementations offer language extensions with 8-bit, 16-bit, 32-bit, and 64-bit integer types, both signed and unsigneds of languages, in addition to the original short, int, and long types.

    I don't know of anyone running a 16-bit machine, but it wouldn't surprise me to find out that there are a few still left out there, running MS DOS or Windows 3.1 or some other operating system that's 15 or more years old.
     
  4. swty_todd

    Thread Starter Active Member

    Aug 3, 2008
    82
    0
    i have an XP and a VISTA .So how do I know whether they are 64 or 32 bits??
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
    Hello,

    Most PC's are deliverd with 32 Bit XP or Vista.
    Many software is still made for 32 Bit.
    There are seperate versions of XP and Vista for 64 Bit.
    They can handle more memory as the 32 Bit versions.
    The standard versions of Windows 2000, XP, Vista and Server 2000 can handle 4GByte of memory.
    The 64 Bit versions can handle (I thought) upto 2 TByte.
    64 Bit software is specialy compiled for it.

    I have tried to use a 64 Bit LINUX some time ago, but a lot of software (like flash player, acrobat reader) did not function. They where made for 32 Bit.

    Greetings,
    Bertus
     
    Last edited: Feb 28, 2009
  6. swty_todd

    Thread Starter Active Member

    Aug 3, 2008
    82
    0
    but how can i find out how many bits my operating system works on?
     
  7. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
    Hello,

    When you rightclick with the mouse on the "my computer" icon and select properties, it will show a window.
    In this window you will see the operating systen, the type of processor ant its speed.

    Greetings,
    Bertus
     
  8. swty_todd

    Thread Starter Active Member

    Aug 3, 2008
    82
    0
    its in hertz. It says 1.46 GHz,0.99 GB RAM.
    so how do i know it in bits?
     
  9. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    System properties (where you just were) will have a line like:

    System:
    Microsoft Windows XP
    Professional
    Version ....

    Similar with Vista.

    If it is 64 bit, it shows
    Microsoft Windows XP
    64bit Edition

    Similar with Vista64

    If you are running Windows XP and didn't specifically buy the 64 bit edition, and most all software downloaded works without issues, it is 32 bit Standard XP. Especially considering the fact you have 1GB of RAM.

    Under Computer, the third section where you got the information above, it doesn't let you know what the processor is actually capable of. Mine is a quad core 64 bit processor running in 32 bit mode, and the information is:
    AMD Phenom(tm) 9850 Quad Core
    Processor
    2.57Ghz, 3.00GB of RAM (although there is 4G installed, XP 32 bit will only use 3)

    If anything in "System" says 64 bit, then it is a 64 bit OS.

    To find out what your processor is, exactly, (NOT Operating System, the hardware is running in 32 bit mode!). there is a freeware program called CPU-Z aka CPUID, which will give you all the info you would want, including open memory slots, memory timing, processor type/model/revision, etc.Also, under the "About" tab in Cpu-Z, it will say if you are running a 64 bit Operating System or not.
     
    Last edited: Feb 28, 2009
Loading...