delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/18/07:05:01

Newsgroups: comp.os.msdos.djgpp
X-Comment-To: Hammy
From: "Oleg O. Ossovitskii" <avatar AT netcity DOT ru>
X-FTN-Sender: "Oleg O. Ossovitskii" <Oleg DOT O DOT Ossovitskii AT p20 DOT f44 DOT n478 DOT z2 DOT fidonet DOT org>
Date: Sun, 17 Oct 99 18:29:53 +0300
Subject: Re: How big is a SHORT?
Message-ID: <940188697@p20.f44.n478.z2.FidoNet.ftn>
References: <4025067169 AT news8 DOT svr DOT pol DOT co DOT uk>
Organization: Without C we'd have BASI, PASAL & OBOL ;-)
X-FTN-AREA: HURRICANE.COMP.OS.MSDOS.DJGPP
X-FTN-MSGID: 2:478/44 DOT 20 AT FidoNet DOT org 380a2419
X-FTN-REPLY: news8.svr.pol.co.uk efe9a6a1
X-FTN-CHRS: IBMPC 2
X-FTN-TID: FastEcho 1.46 28860835
X-FTN-Tearline: GoldEd/386 3.0.1-asa9 SR1
X-FTN-Origin: Without C we'd have BASI, PASAL & OBOL ;-) (2:478/44.20)
X-FTN-SEEN-BY: 478/44
X-FTN-PATH: 478/44
X-FTN-PATH: 478/44
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello, Hammy!

 On 16 Oct 99, 17:55 Hammy wrote to All

 H> so, how many bits is it?
 H> most books say it it the same as an int, but when I make a structures
 H> using int and shorts, they give different results?

Please, compile and run this program and see results.
==================  Begin of 12448.cpp  =================
#include <iostream.h>
#include <stdlib.h>
using namespace std;

template <class T> size_t size_of() {return sizeof(T);};

int main()
{
    cout
        << size_of<char>()
        << size_of<short>()
        << size_of<int>()
        << size_of<long>()
        << size_of<double>()
        << endl;
    return 0;
}

// This program print "12448" ===================  End of 12448.cpp
==================

WBR, Oleg Ossovitskii E-mail: avatar AT netcity DOT ru

... Solve millenuim bug! - y2k.com [ FA EB FE C3 ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019