[M3devel] double double double double checking jmp_buf size/alignment

Mika Nystrom mika at async.async.caltech.edu
Wed Jan 6 17:25:58 CET 2010


Forgot the #endif there?

(81)trs80:~>./a.out
48 4
(82)trs80:~>uname -a
FreeBSD trs80.async.caltech.edu 4.11-RELEASE FreeBSD 4.11-RELEASE #3: Mon Nov 21 20:27:08 PST 2005     root at trs80.async.caltech.edu:/usr/src/sys/compile/TRS80  i386

[lapdog:~] mika% cc jay.c
[lapdog:~] mika% ./a.out
768 4
[lapdog:~] mika% uname -a
Darwin lapdog 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc
[lapdog:~] mika% 

Jay K writes:
>--_b0fc625a-8a60-4f2b-9394-0f52cc975894_
>Content-Type: text/plain; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>
>Was truncated!..edited slightly to avoid..
>
>
>From: jay.krell at cornell.edu
>To: m3devel at elegosoft.com
>Subject: double double double double checking jmp_buf size/alignment
>Date: Wed=2C 6 Jan 2010 12:28:02 +0000
>
>
>
>
>
>
>
>
>Getting this right is very important.
>  Well=2C we can overstate but it is wasteful.
>
>
>So anyone with any time=2C please compile/run this and send the "platform" =
>(uname -a) and the output=2C thanks.
>Or look at m3-libs/m3core/src/C/*/Csetjmp.i3 and
>m3-sys/m3middle/src/Target.m3 and see if all three agree.
>
>
>I have checked a bunch of systems myself but extra checking is good.
>
>
>If you have a system we do not yet or any longer support=2C those are ok to=
>o.
> (e.g. Alpha_*=2C ARM_*=2C MIPS_*=2C *_Irix=2C *_VMS=2C *_Tru64 etc.)
>
>=20
>#include <setjmp.h>
>#include <stdio.h>
>
>#ifdef __GNUC__
>#define ALIGN_OF(x) ((int)(sizeof(struct { char a=3B x b=3B }) - sizeof(x))=
>)
>#else
>#define ALIGN_OF(x) ((int)__alignof(x))
>
>int main()
>{
>  printf("%d %d\n"=2C (int)sizeof(jmp_buf)=2C ALIGN_OF(jmp_buf))=3B
>  return 0=3B
>}
>
>
>Thanks=2C
> - Jay
> 		 	   		  =
>
>--_b0fc625a-8a60-4f2b-9394-0f52cc975894_
>Content-Type: text/html; charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><html>
><head>
><style><!--
>.hmmessage P
>{
>margin:0px=3B
>padding:0px
>}
>body.hmmessage
>{
>font-size: 10pt=3B
>font-family:Verdana
>}
>--></style>
></head>
><body class=3D'hmmessage'>
>Was truncated!..edited slightly to avoid..<br><br><br><hr id=3D"stopSpellin=
>g">From: jay.krell at cornell.edu<br>To: m3devel at elegosoft.com<br>Subject: dou=
>ble double double double checking jmp_buf size/alignment<br>Date: Wed=2C 6 =
>Jan 2010 12:28:02 +0000<br><br>
>
>
>
><style>
>.ExternalClass .ecxhmmessage P
>{padding:0px=3B}
>.ExternalClass body.ecxhmmessage
>{font-size:10pt=3Bfont-family:Verdana=3B}
></style>
>
>
>Getting this right is very important.<br>&nbsp=3B Well=2C we can overstate =
>but it is wasteful.<br><br><br>So anyone with any time=2C please compile/ru=
>n this and send the "platform" (uname -a) and the output=2C thanks.<br>Or l=
>ook at m3-libs/m3core/src/C/*/Csetjmp.i3 and<br>m3-sys/m3middle/src/Target.=
>m3 and see if all three agree.<br><br><br>I have checked a bunch of systems=
> myself but extra checking is good.<br><br><br>If you have a system we do n=
>ot yet or any longer support=2C those are ok too.<br>&nbsp=3B(e.g. Alpha_*=
>=2C ARM_*=2C MIPS_*=2C *_Irix=2C *_VMS=2C *_Tru64 etc.)<br><br>&nbsp=3B<br>=
>#include &lt=3Bsetjmp.h&gt=3B<br>#include &lt=3Bstdio.h&gt=3B<br><br>#ifdef=
> __GNUC__<br>#define ALIGN_OF(x) ((int)(sizeof(struct { char a=3B x b=3B })=
> - sizeof(x)))<br>#else<br>#define ALIGN_OF(x) ((int)__alignof(x))<br><br>i=
>nt main()<br>{<br>&nbsp=3B printf("%d %d\n"=2C (int)sizeof(jmp_buf)=2C ALIG=
>N_OF(jmp_buf))=3B<br>&nbsp=3B return 0=3B<br>}<br><br><br>Thanks=2C<br>&nbs=
>p=3B- Jay<br> 		 	   		  </body>
></html>=
>
>--_b0fc625a-8a60-4f2b-9394-0f52cc975894_--



More information about the M3devel mailing list