From owner-freebsd-questions Thu Jan 13 5: 1:49 2000 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.pit.adelphia.net (alpha.pit.adelphia.net [24.48.44.2]) by hub.freebsd.org (Postfix) with ESMTP id 519C4154B4 for ; Thu, 13 Jan 2000 05:01:46 -0800 (PST) (envelope-from evstiounin@adelphia.net) Received: from evstiouninadelphia (surf15-222.pit.adelphia.net [24.48.53.222]) by alpha.pit.adelphia.net (8.9.2/8.9.2) with SMTP id IAA19967 for ; Thu, 13 Jan 2000 08:01:36 -0500 (EST) Message-ID: <00eb01bf5dc6$5adffe00$fc353018@evstiouninadelphia.net.pit.adelphia.net> From: "Mikhail Evstiounin" To: Subject: Re: Giving a sighandler more information Date: Thu, 13 Jan 2000 08:01:49 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG -----Original Message----- From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG Date: Wednesday, January 12, 2000 11:42 PM Subject: Re: Giving a sighandler more information >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: Oliver, IT'S A REQUIRIMENTS OF THE STANDARD!!! - NOT MY WISH!!! And Alpha compiler just plain violates this standard (BTW, didn't check recent C standard - C99 or C98). This requirement was in there for the purpose - portability. > > #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.) > Agreed. This is a real life. But take a look at the standard: sizeof(short)<=sizeof(int)<=sizeof(long) and sizeof(void*)==sizeof(int). GCC team is very accurate - if they know that they have something incompatible with ANSI standard they always tell it - there is a whole document in distributuive that states what is different and why GCC team thinks it should be different. > > 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. Thanx. >And this is perfectly within ANSI spec. My reading of ANSI is slightly different. As someone who participate in writing of 5 compilers I worked with standards a lot. But I didn't do it anymore since 1995. And since then C commmitte added a lot of stuff to new standard. Could you point me to the ANSI standard you are refence to? I was talking about, I believe, C89. > >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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message