From owner-freebsd-questions@FreeBSD.ORG Wed Oct 24 02:00:57 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B2C116A418 for ; Wed, 24 Oct 2007 02:00:57 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout2.cac.washington.edu (mxout2.cac.washington.edu [140.142.33.4]) by mx1.freebsd.org (Postfix) with ESMTP id 6EE0013C48D for ; Wed, 24 Oct 2007 02:00:57 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.139]) by mxout2.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.09) with ESMTP id l9O20htg004446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Oct 2007 19:00:44 -0700 X-Auth-Received: from dzihan.cs.washington.edu (dzihan.cs.washington.edu [128.208.4.96]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.09) with ESMTP id l9O20g1N019469 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 23 Oct 2007 19:00:43 -0700 Message-ID: <471EA74A.6060206@u.washington.edu> Date: Tue, 23 Oct 2007 19:00:42 -0700 From: Garrett Cooper User-Agent: Thunderbird 2.0.0.6 (X11/20071003) MIME-Version: 1.0 To: Bruce Cran , questions@freebsd.org References: <200710232044.53240.h.schmalzbauer@omnisec.de> <20071023220134.3abd635e@epia-2.farid-hajji.net> <20071023162454.93851854.wmoran@potentialtech.com> <200710232324.09851.h.schmalzbauer@omnisec.de> <20071024002649.6cc41512@epia-2.farid-hajji.net> <471E7778.4060909@cran.org.uk> In-Reply-To: <471E7778.4060909@cran.org.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.3.310218, Antispam-Engine: 2.5.2.313940, Antispam-Data: 2007.10.23.183619 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='BODY_SIZE_700_799 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Cc: Subject: Re: Mentor for C self study wanted X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2007 02:00:57 -0000 Bruce Cran wrote: > cpghost wrote: > >> There's a mismatch here: scanf("%d", ...) expects a pointer to int, >> while &nnote is a pointer to a short. Normally, an int occupies more >> bytes in memory than a short (typically sizeof(int) == 4 on 32bit >> platforms, and sizeof(int) == 8 on 64bit platforms; while typically >> sizeof(short) == 2). > > I think short and int stay the same on both 32 and 64 bit platforms, > while it's only long that gets bumped to 8 bytes. At least that seems > to be what happens on FreeBSD amd64. > > -- > Bruce No... you're only safe using int32, int64, etc. Just for grins try compiling a program like this: #include int main() { printf("%d\n", sizeof(int)); return 0; }