Xenix 386 GCC: an interim patch.

Steve.Bleazard at Robobar.Co.Uk Steve.Bleazard at Robobar.Co.Uk
Wed May 2 03:24:24 AEST 1990


[ If you're looking for the archive sub-headers, there aren't any.
  Wait for the complete patch kit if you need them :-) ]

Here are some enhancements to my port of GCC to Xenix.  A complete patch
kit relative to the original GNU distribution will be posted to
comp.sources.misc soon.  This patch kit is for those of you who have
already installed my other kits and want to upgrade NOW.  This will
bring you almost to the same release level as binary kits I distribute marked
1.37.1c <-- note the 'c'.

*** ../gcc-1.37.old/c-parse.y	Wed Jan 17 06:13:26 1990
--- ./c-parse.y	Tue Apr 24 11:07:55 1990
***************
*** 1783,1788 ****
--- 1783,1829 ----
  	      && getc (finput) == 'm'
  	      && getc (finput) == 'a'
  	      && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
+ #ifdef PRAGMA_PACK
+ 	  {
+ 		token = yylex();
+ 	        if (token != IDENTIFIER) 
+ 		    goto skipline;
+ 
+ 	        if (strcmp(token_buffer, "pack") != 0)
+ 		        goto skipline;
+ 		
+ 		token = yylex();
+   		if (token != '(') {
+ 			error ("invalid #pragma pack expecting '('");
+ 			goto skipline;
+ 		}
+ 
+ 		/* setup default alignment first */
+ 
+ 		pragma_pack_default();
+ 
+ 		token = yylex();
+ 		if (token != ')')
+ 		{
+ 			if (token == CONSTANT
+ 				&& TREE_CODE (yylval.ttype) == INTEGER_CST) {
+ 				int l = TREE_INT_CST_LOW (yylval.ttype);
+ 				pragma_pack(l);
+ 			}
+ 			else {
+ 				error ("invalid #pragma pack expecting 1, 2 or 4");
+ 				goto skipline;
+ 			}
+ 
+ 			token = yylex();
+ 		}
+ 
+   		if (token != ')') {
+ 			error ("invalid #pragma pack expecting ')'");
+ 			goto skipline;
+ 		}
+ 	    }
+ #endif
  	    goto skipline;
  	}
  
*** ../gcc-1.37.old/Changes.Xenix	Thu Jan  1 00:00:00 1970
--- ./Changes.Xenix	Mon Apr 30 20:57:14 1990
***************
*** 0 ****
--- 1,52 ----
+ Here are some enhancements to my port of GCC to Xenix.  A complete patch
+ kit relative to the original GNU distribution will be posted to
+ comp.sources.misc soon.  This patch kit is for those of you who have
+ already installed my other kits and want to upgrade NOW.  This will
+ bring you almost to the same release level as binary kits I distribute marked
+ 1.37.1c <-- note the 'c'.
+ 
+         o  made TARGET_DEFAULT 1, which implies default -m80387.
+ 
+         o  fixed gcc -p to make the result compatible with Microsoft's
+            profiling support.  Results largely untested by me.
+ 
+         o  fixed linker specification to handle -s -r -u and -F
+            (the last is ignored by ld, but is useful so as not to break
+             existing Makefiles)
+ 
+         o  added optional support for Microsoft's #pragma pack()
+            hack.  This enables people compile GNU Make, my ranlib(CP) and
+            Ron Kuris's GDB port with GCC.  This is switched on by default,
+            but can be disabled by removing #define PRAGMA_PACK from
+            tm-xenix386.h.  This modification will in any case not take effect
+            until the first #pragma pack() is seen in any one source file.
+            A program to test this "feature" called  packtest.c is included
+            Check its leading comment for instructions.
+ 
+            When compiled in, it will identify its presence in the cc1 -version
+            output string.
+ 
+         o  undefined PCC_BITFIELD_TYPE_MATTERS because I *suspect* that
+            it may interfere with #pragma pack() and its behaviour was not
+            compatible with MSC in the first place.  It still isn't
+            (when your structures have bitfields in them).
+ 
+            I think this means that if you need Microsoft binary
+            compatibility, you will have to edit your .h files to put
+            explicit padding into structs that have bitfields where Microsoft
+            seems to do so by default.  Or you could hack stor-layout.c :-)
+ 
+         o  removed stddef.h hack -- moved into Makefile.  This is needed for
+            the item immediately below.  Please remove -D_SIZE_T when
+            compiling GCC with GCC, e.g. by following our original instructions.
+ 
+         o  Ronald's hack of a include file fixer included (fix.h.xenix).
+            Running it with the -all flag will allow you to compile gcc with
+            gcc without the -traditional flag (if you already have a working
+            gcc, or for the stage2 build) READ IT FIRST, because it's only
+            likely to work for you out of the packet if your include files
+            look exactly like ours.
+ 
+         o  ASM_SPEC in tm-xenix386.h: pass -v flag to gas from gcc.
+ 
+         o  Enabled production of DBX debugging information for future use.
*** ../gcc-1.37.old/Makefile	Tue Apr 24 00:34:17 1990
--- ./Makefile	Tue Apr 24 11:08:03 1990
***************
*** 21,27 ****
  # Variables that exist for you to override.
  # See below for how to change them for certain systems.
  
! CFLAGS = -g $(XCFLAGS)
  CC = cc
  BISON = bison
  BISONFLAGS = -v
--- 21,27 ----
  # Variables that exist for you to override.
  # See below for how to change them for certain systems.
  
! CFLAGS = -g $(XCFLAGS) -D_SIZE_T
  CC = cc
  BISON = bison
  BISONFLAGS = -v
***************
*** 28,34 ****
  AR = ar
  SHELL = /bin/sh
  # on sysV, define this as cp.
! INSTALL = install -c
  
  # Compiler to use for compiling gnulib.
  # OLDCC should not be the GNU C compiler.
--- 28,34 ----
  AR = ar
  SHELL = /bin/sh
  # on sysV, define this as cp.
! INSTALL = cp
  
  # Compiler to use for compiling gnulib.
  # OLDCC should not be the GNU C compiler.
***************
*** 145,151 ****
   symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \
   integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
   regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
!  insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o
  
  # Files to be copied away after each stage in building.
  STAGE_GCC=gcc
--- 145,151 ----
   symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \
   integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
   regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
!  insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o pragma.o
  
  # Files to be copied away after each stage in building.
  STAGE_GCC=gcc
*** ../gcc-1.37.old/config/tm-xenix386.h	Tue Apr 24 00:34:20 1990
--- ./config/tm-xenix386.h	Mon Apr 30 20:41:53 1990
***************
*** 26,37 ****
  
  /* By default, target has a no 80387.  */
  
! #define TARGET_DEFAULT 0
  
  /* Use crt1.o as a startup file and crtn.o as a closing file.  */
  
! #define STARTFILE_SPEC  "Sseg.o%s Scrt0.o%s"
  
  #define LIB_SPEC "Slibcfp.a%s Slibc.a%s"
  
  #define LINK_SPEC "-i"
--- 26,41 ----
  
  /* By default, target has a no 80387.  */
  
! #define TARGET_DEFAULT 1
  
  /* Use crt1.o as a startup file and crtn.o as a closing file.  */
  
! #define STARTFILE_SPEC  "Sseg.o%s %{!p:Scrt0.o%s} %{p:Smcrt0.o%s}"
  
+ /* -v is appropriate for use with GAS */
+ 
+ #define ASM_SPEC	"%{v}"
+ 
  #define LIB_SPEC "Slibcfp.a%s Slibc.a%s"
  
  #define LINK_SPEC "-i"
***************
*** 55,63 ****
  
  #undef SDB_DEBUGGING_INFO
  
! /* We don't want to output DBX debugging information.  */
  
! #undef DBX_DEBUGGING_INFO
  
  /* Implicit library calls should use memcpy, not bcopy, etc.  */
  
--- 59,67 ----
  
  #undef SDB_DEBUGGING_INFO
  
! /* We want to output DBX debugging information.  */
  
! #define DBX_DEBUGGING_INFO
  
  /* Implicit library calls should use memcpy, not bcopy, etc.  */
  
***************
*** 65,71 ****
  
  /* Writing `int' for a bitfield forces int alignment for the structure.  */
  
! #define PCC_BITFIELD_TYPE_MATTERS
  
  /* Generate an external symbol request for __fltused if 80387 selected */
  
--- 69,75 ----
  
  /* Writing `int' for a bitfield forces int alignment for the structure.  */
  
! #undef PCC_BITFIELD_TYPE_MATTERS
  
  /* Generate an external symbol request for __fltused if 80387 selected */
  
***************
*** 99,101 ****
--- 103,113 ----
  
  #undef ASM_OUTPUT_CASE_END
  #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) text_section()
+ 
+ #undef FUNCTION_PROFILER
+ #define FUNCTION_PROFILER(FILE, LABELNO)  \
+    fprintf (FILE, "\tmovl $%sP%d,%%edx\n\tcall __mcount\n", LPREFIX, (LABELNO));
+ 
+ /* Implement Microsoft C compatible #pragma pack() */
+ 
+ #define PRAGMA_PACK
*** ../gcc-1.37.old/config/tm-xgas386.h	Tue Apr 24 00:34:20 1990
--- ./config/tm-xgas386.h	Tue Apr 24 11:07:57 1990
***************
*** 18,24 ****
--- 18,28 ----
  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
  
+ #ifdef PRAGMA_PACK
+ #define TARGET_VERSION fprintf (stderr, " (80386, Xenix GAS syntax, #pragma pack() support included)");
+ #else
  #define TARGET_VERSION fprintf (stderr, " (80386, Xenix GAS syntax)");
+ #endif
  
  /* Define the syntax of instructions and addresses.  */
  
*** ../gcc-1.37.old/fix.h.xenix	Thu Jan  1 00:00:00 1970
--- ./fix.h.xenix	Wed Apr 25 17:52:02 1990
***************
*** 0 ****
--- 1,146 ----
+ :
+ # @(#)$Header: /pdsrc/Local/RCS/fix.h.xenix,v 1.1 90/04/25 18:51:21 root Exp $
+ #
+ # (C) Copyright 1990 Ronald Khoo <ronald at robobar.co.uk>
+ # Permission granted to use or abuse this program for any purpose,
+ # provided that all modified copies are clearly marked as such.
+ # No warranty is given for the fitness of this program for any purpose.
+ # Please treat this file as a document saying what I did and not a program.
+ # Please mail me any changes you make, I will coordinate patches.
+ #
+ # This is a quick hack to fix the SCO Xenix 386 include files so that
+ # they work correctly with gcc.  No attempt has been made to do this
+ # in a general way whatsoever, and this script was not made with any
+ # reference to the GCC fixincludes script:  I still have no idea what
+ # that does.  This works (ish) for me.  Your mileage may vary.
+ # My include files were from the 2.3.2 operating system and the 2.3
+ # development system.  I'll be interested to hear what works for 2.2 based
+ # systems.
+ #
+ # If your stddef.h says #ifdef M_XENIX #define _SIZE_T, remove those 3 lines.
+ # (That was a hack Steve put in that is no longer needed once you run this
+ #  program)
+ # You should also change the typedef of size_t in there to read:
+ # typedef unsigned int size_t;
+ #
+ # * stream edit files from /usr/include and /usr/include/sys
+ #   into /usr/local/lib/gcc-include, skipping those which are
+ #   provided by GCC.
+ # * make all references to M_I386 refer to __M_I386__ instead.
+ #   This enables programs compiled with gcc -ansi not to coredump.
+ #   This only works with gcc so don't give these hacked .h files to cc !!
+ # * put protection #ifdef tests to all files to allow them to be safely
+ #   multiply included.
+ # * time_t and size_t seem to be typedefed all over the place.  Protect them.
+ #
+ # My sys/signal.h seemed to define some things as void and some as int. Barf.
+ # I made it all say void by using the probably flakey ed script below
+ # that's only run if you give the -all argument.
+ # It works for me, but I don't trust it to work with your sys/signal.h
+ # without your looking at it first.
+ # I don't know how to write a C parser in sed.
+ #
+ # I also made the buffer arguments in stdio.h to fread and fwrite
+ # void* instead of char* because I prefer to limit the warning messages I read
+ # to those that matter.  What does ANSI say they should be ?
+ # You should remove declaration of va_list from stdio.h.  This is bogus.
+ # Both these are also done in another ed script below that's only run if
+ # you say -all.
+ #
+ # $Log:	fix.h.xenix,v $
+ # Revision 1.1  90/04/25  18:51:21  root
+ # Initial revision
+ # 
+ 
+ PATH=/etc:/bin:/usr/bin export PATH
+ 
+ # usage: /usr/local/lib/fix.h.xenix [ -all ]
+ # saying -all implies that you have stock 2.3 Dev Sys include files and
+ # you want them to look like mine.
+ 
+ script='
+ /M_I386/s//__&__/g
+ /typedef.*[ 	]time_t/ {
+ i\
+ #ifndef _TIME_T
+ i\
+ #define _TIME_T
+ a\
+ #endif /* _TIME_T */
+ }
+ /typedef.*[ 	]size_t/ {
+ i\
+ #ifndef _SIZE_T
+ i\
+ #define _SIZE_T
+ a\
+ #endif /* _SIZE_T */
+ }
+ '
+ 
+ [ -d /usr/local/lib/gcc-include ] || mkdir /usr/local/lib/gcc-include
+ [ -d /usr/local/lib/gcc-include/sys ] || mkdir /usr/local/lib/gcc-include/sys
+ 
+ cd /usr/include
+ for i in *.h  sys/*.h
+ do
+ case $i in
+ assert.h)	;;	# Use the GCC supplied versions of these 6 files
+ float.h)	;;
+ limits.h)	;;
+ stdarg.h)	;;
+ stddef.h)	;;
+ varargs.h)	;;
+ *)
+ 	echo Hacking $i >&2
+ 	name=_INCLUDED_`echo $i | tr './[a-z]' '__[A-Z]'`_AUTOFIX
+ 	echo "#ifndef $name" > /usr/local/lib/gcc-include/$i
+ 	echo "#define $name" >> /usr/local/lib/gcc-include/$i
+ 	sed -e "$script" $i >> /usr/local/lib/gcc-include/$i
+ 	echo "#endif /* $name */" >> /usr/local/lib/gcc-include/$i
+ ;;
+ esac
+ done
+ 
+ # This is the bit which tries to edit sys/signal.h
+ burp1()
+ {
+ 	echo Hacking sys/signal.h again. Yawn. >&2
+ 	ed - /usr/local/lib/gcc-include/sys/signal.h <<'EOF'
+ 	g/^#define.*int[ 	]*(\*)/s/int/void/g
+ 	w
+ 	q
+ EOF
+ }
+ 
+ # This is the bit which tries to edit stdio.h
+ burp2()
+ {
+ 	echo Hacking stdio.h again. Yawn. >&2
+ 	ed - /usr/local/lib/gcc-include/stdio.h <<'EOF'
+ 	g/typedef.*va_list/d
+ 	g/^extern.*fread/s/char/void/
+ 	g/^extern.*fwrite/s/char/void/
+ 	w
+ 	q
+ EOF
+ }
+ 
+ # Only call with -all if you think your include files look enough like
+ # mine for these scripts to work.
+ if [ x$1 = x-all ] ; then
+ 	burp1
+ 	burp2
+ fi
+ 
+ cd /usr/local/lib/gcc-include
+ find . -print | xargs chown bin
+ find . -print | xargs chgrp bin
+ find . -type f -print | xargs chmod 664
+ chmod 775  /usr/local/lib/gcc-include /usr/local/lib/gcc-include/sys
+ echo '
+ 
+ done. Enjoy.
+ 
+ --Ronald.
+ ' >&2
*** ../gcc-1.37.old/gcc.c	Tue Apr 24 00:34:19 1990
--- ./gcc.c	Tue Apr 24 11:07:53 1990
***************
*** 208,213 ****
--- 208,224 ----
  
  /* This defines which switch letters take arguments.  */
  
+ #ifdef M_XENIX
+ #ifndef SWITCH_TAKES_ARG
+ #define SWITCH_TAKES_ARG(CHAR)      \
+   ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
+    || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
+    || (CHAR) == 'I' || (CHAR) == 'Y' || (CHAR) == 'm' \
+    || (CHAR) == 'L' || (CHAR) == 'i' || (CHAR) == 'A' \
+    || (CHAR) == 'F')
+ #endif
+ #endif
+ 
  #ifndef SWITCH_TAKES_ARG
  #define SWITCH_TAKES_ARG(CHAR)      \
    ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
***************
*** 417,423 ****
  
  /* Here is the spec for running the linker, after compiling all files.  */
  #ifdef M_XENIX
! char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l %{g:-g}\
   %{!nostdlib:%S} %{!o:-o a.out} %o %Z %{!nostdlib:gnulib%s %L }\n }}}}";
  #else /* not M_XENIX */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
--- 428,435 ----
  
  /* Here is the spec for running the linker, after compiling all files.  */
  #ifdef M_XENIX
! char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l %{g:-g} \
!  %{A} %{F} %{r} %{s} %{u*} \
   %{!nostdlib:%S} %{!o:-o a.out} %o %Z %{!nostdlib:gnulib%s %L }\n }}}}";
  #else /* not M_XENIX */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
*** ../gcc-1.37.old/pragma.c	Thu Jan  1 00:00:00 1970
--- ./pragma.c	Tue Apr 24 11:07:57 1990
***************
*** 0 ****
--- 1,26 ----
+ #define DEFAULT_ALIGN	32
+ 
+ static int pack_align = DEFAULT_ALIGN;
+ static int was_pragma = 0;
+ 
+ pragma_pack(val)
+ int val;
+ {
+ 	pack_align = 8 * val;
+ 	was_pragma = 1;
+ }
+ 
+ pragma_align_val()
+ {
+ 	return pack_align;
+ }
+ 
+ pragma_pack_default()
+ {
+ 	pack_align = DEFAULT_ALIGN;
+ }
+ 
+ int pragma_pack_seen()
+ {
+ 	return was_pragma;
+ }
*** ../gcc-1.37.old/stddef.h	Tue Apr 24 00:34:19 1990
--- ./stddef.h	Tue Apr 24 11:07:53 1990
***************
*** 7,16 ****
  
  /* Unsigned type of `sizeof' something.  */
  
- #ifdef M_XENIX
- #define _SIZE_T
- #endif
- 
  #ifndef _SIZE_T	/* in case <sys/types.h> has defined it. */
  #define _SIZE_T
  typedef unsigned long size_t;
--- 7,12 ----
*** ../gcc-1.37.old/stor-layout.c	Wed Jan 17 18:21:06 1990
--- ./stor-layout.c	Tue Apr 24 11:07:56 1990
***************
*** 498,503 ****
--- 498,507 ----
  	 or some divisor of it.  */
  
        layout_decl (field, var_size ? size_unit : const_size);
+ #ifdef PRAGMA_PACK
+       if (pragma_pack_seen())
+         DECL_ALIGN(field) = MIN(pragma_align_val(), DECL_ALIGN(field));
+ #endif
        desired_align = DECL_ALIGN (field);
  
        /* Record must have at least as much alignment as any field.
*** ../gcc-1.37.old/c-parse.tab.c	Wed Jan 17 06:13:47 1990
--- ./c-parse.tab.c	Tue Apr 24 11:08:01 1990
***************
*** 2906,2911 ****
--- 2906,2952 ----
  	      && getc (finput) == 'm'
  	      && getc (finput) == 'a'
  	      && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
+ #ifdef PRAGMA_PACK
+ 	  {
+ 		token = yylex();
+ 	        if (token != IDENTIFIER)
+ 		    goto skipline;
+ 
+ 	        if (strcmp(token_buffer, "pack") != 0)
+ 		        goto skipline;
+ 
+ 		token = yylex();
+   		if (token != '(') {
+ 			error ("invalid #pragma pack expecting '('");
+ 			goto skipline;
+ 		}
+ 
+ 		/* setup default alignment first */
+ 
+ 		pragma_pack_default();
+ 
+ 		token = yylex();
+ 		if (token != ')')
+ 		{
+ 			if (token == CONSTANT
+ 				&& TREE_CODE (yylval.ttype) == INTEGER_CST) {
+ 				int l = TREE_INT_CST_LOW (yylval.ttype);
+ 				pragma_pack(l);
+ 			}
+ 			else {
+ 				error ("invalid #pragma pack expecting 1, 2 or 4");
+ 				goto skipline;
+ 			}
+ 
+ 			token = yylex();
+ 		}
+ 
+   		if (token != ')') {
+ 			error ("invalid #pragma pack expecting ')'");
+ 			goto skipline;
+ 		}
+ 	    }
+ #endif
  	    goto skipline;
  	}
  
*** packtest.c.old	Thu Jan  1 00:00:00 1970
--- packtest.c	Mon Apr 30 20:57:14 1990
***************
*** 0 ****
--- 1,95 ----
+ static char *rcsid = "@(#)$Header: /pdsrc/Local/RCS/packtest.c,v 1.1 90/04/26 17:50:35 root Exp $";
+ 
+ /*
+  * Regression test to check that gcc's #pragma pack() support does the
+  * same thing as Microsoft C's.
+  *
+  * Run with this command from sh, not csh, since SCO's csh is BROKEN.
+  * cc packtest.c && ./a.out > m && gcc packtest.c && ./a.out > g && diff m g
+  * You should not see any output.
+  *
+  * $Log:	packtest.c,v $
+  * Revision 1.1  90/04/26  17:50:35  root
+  * Initial revision
+  * 
+  */
+ 
+ #pragma pack(4)
+ struct s1 {
+ 	char one;
+ 	int  two;
+ 	long three;
+ 	double four;
+ } s1;
+ #pragma pack(2)
+ struct s2 {
+ 	char one;
+ 	int  two;
+ 	long three;
+ 	double four;
+ } s2;
+ #pragma pack(1)
+ struct s3 {
+ 	char one;
+ 	int  two;
+ 	long three;
+ 	double four;
+ } s3;
+ #pragma pack()
+ struct s4 {
+ 	char one;
+ 	int  two;
+ 	long three;
+ 	double four;
+ } s4;
+ struct biggie {
+ 	struct s3 x1;
+ 	struct s1 b1;
+ 	struct s3 x2;
+ 	struct s2 b2;
+ 	struct s3 x3;
+ 	struct s3 b3;
+ 	struct s3 x4;
+ 	struct s4 b4;
+ } b;
+ #define offsetof(TYPE, MEMBER) ((unsigned) &((TYPE *)0)->MEMBER)
+ main()
+ {
+ 	printf("% 4d% 4d% 4d\n",
+ 		offsetof(struct s1, two),
+ 		offsetof(struct s1, three),
+ 		offsetof(struct s1, four));
+ 	printf("% 4d% 4d% 4d\n",
+ 		offsetof(struct s2, two),
+ 		offsetof(struct s2, three),
+ 		offsetof(struct s2, four));
+ 	printf("% 4d% 4d% 4d\n",
+ 		offsetof(struct s3, two),
+ 		offsetof(struct s3, three),
+ 		offsetof(struct s3, four));
+ 	printf("% 4d% 4d% 4d\n",
+ 		offsetof(struct s4, two),
+ 		offsetof(struct s4, three),
+ 		offsetof(struct s4, four));
+ 	printf("\n% 4d% 4d% 4d\n",
+ 		((char *)&b.b1.two) - ((char *)&b.b1.one),
+ 		((char *)&b.b1.three) - ((char *)&b.b1.one),
+ 		((char *)&b.b1.four) - ((char *)&b.b1.one));
+ 	printf("% 4d% 4d% 4d\n",
+ 		((char *)&b.b2.two) - ((char *)&b.b2.one),
+ 		((char *)&b.b2.three) - ((char *)&b.b2.one),
+ 		((char *)&b.b2.four) - ((char *)&b.b2.one));
+ 	printf("% 4d% 4d% 4d\n",
+ 		((char *)&b.b3.two) - ((char *)&b.b3.one),
+ 		((char *)&b.b3.three) - ((char *)&b.b3.one),
+ 		((char *)&b.b3.four) - ((char *)&b.b3.one));
+ 	printf("% 4d% 4d% 4d\n\n",
+ 		((char *)&b.b4.two) - ((char *)&b.b4.one),
+ 		((char *)&b.b4.three) - ((char *)&b.b4.one),
+ 		((char *)&b.b4.four) - ((char *)&b.b4.one));
+ 	printf("    % 4d% 4d\n", sizeof b.b1, (char *)&b.b1 - (char *)&b);
+ 	printf("    % 4d% 4d\n", sizeof b.b2, (char *)&b.b2 - (char *)&b);
+ 	printf("    % 4d% 4d\n", sizeof b.b3, (char *)&b.b3 - (char *)&b);
+ 	printf("    % 4d% 4d\n", sizeof b.b4, (char *)&b.b4 - (char *)&b);
+ 	exit(0);
+ }

-- 
Steve.Bleazard at RoboBar.Co.Uk        | Phone:  +44 1 991 1142 x153
Snr Software Engineer, Robobar Ltd. | Fax:    +44 1 998 8343 (G3)
22 Wadsworth Road, Perivale.        |
Middx., UB6 7JD ENGLAND.            | ...!ukc!robobar!steve



More information about the Alt.sources mailing list