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

Jay K jay.krell at cornell.edu
Wed Jan 6 13:28:02 CET 2010


Getting this right is very important.
  Well, we can overstate but it is wasteful.


So anyone with any time, please compile/run this and send the "platform" (uname -a) and the output, 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 don't yet or any longer support, those are ok too.
 (e.g. Alpha_*, ARM_*, MIPS_*, *_Irix, *_VMS, *_Tru64 etc.)

 
#include <setjmp.h>
#include <stdio.h>

#ifdef __GNUC__
#define ALIGN_OF(x) ((int)(sizeof(struct { char a; x b; }) - sizeof(x)))
#else
#define ALIGN_OF(x) ((int)__alignof(x))

int main()
{
  printf("%d %d\n", (int)sizeof(jmp_buf), ALIGN_OF(jmp_buf));
  return 0;
}


Thanks,
 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100106/26f1fbaf/attachment-0001.html>


More information about the M3devel mailing list