From owner-freebsd-questions Wed Jan 12 20:41:51 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252]) by hub.freebsd.org (Postfix) with ESMTP id 26D3B15449 for ; Wed, 12 Jan 2000 20:41:45 -0800 (PST) (envelope-from olli@dorifer.heim3.tu-clausthal.de) Received: (from olli@localhost) by dorifer.heim3.tu-clausthal.de (8.9.3/8.9.3) id FAA69981; Thu, 13 Jan 2000 05:41:43 +0100 (CET) (envelope-from olli) Date: Thu, 13 Jan 2000 05:41:43 +0100 (CET) Message-Id: <200001130441.FAA69981@dorifer.heim3.tu-clausthal.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG Reply-To: freebsd-questions@FreeBSD.ORG Subject: Re: Giving a sighandler more information X-Newsgroups: list.freebsd-questions In-Reply-To: <85jef2$1q71$1@atlantis.rz.tu-clausthal.de> User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (FreeBSD/3.4-19991219-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mikhail Evstiounin wrote in list.freebsd-questions: > From: Oliver Fromme >>Laurence Berland wrote in list.freebsd-questions: >> > Followup question: is a sig_atomic_t appropriate to hold the value of a >> > FILE * ? >> >>No. It is only guaranteed to be large enough to hold an int. >>Of course, on intel PCs, a pointer has the same size as an int, >>but not on other platforms (e.g. the Alpha). Therefore, >>portable programs cannot store a pointer in a sig_atomic_t. > > Sorry, guys, but it requirenments of ANSI that sizeof(void*)==sizeof(int). No! A program which assumes that an int is large enough to store a pointer is BROKEN. See this simple test program: #include int main (int argc, char *argv[]) { printf("sizeof(int) == %d\n", sizeof(int)); printf("sizeof(void*) == %d\n", sizeof(void*)); return 0; } On an Alpha (64bit), the result is: sizeof(int) == 4 sizeof(void*) == 8 That was compiled with DEC's C compiler in -std1 mode. This is one of the most ANSI/ISO-compliant compilers that I'm aware of. (Note that gcc is not that ANSI-compliant.) > and question does it mean that alpha integer is 32 bit, or pointer has more > than 64? See above. ints are 32 bits, pointers are 64 bits. And this is perfectly within ANSI spec. Regards Oliver -- Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) "In jedem Stück Kohle wartet ein Diamant auf seine Geburt" (Terry Pratchett) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message