Portability question for structures.

Doug Olson olson at cuda.aaet.csc.ti.com
Thu Jun 20 05:40:46 AEST 1991


	I have a set of list processing functions that have the 
typedef 
		typedef struct double_list
                {
	           void *next;
	           void *prev;
                   char *key;
                } s_double_list;

This is the structure that these functions manipulate. When structures are 
passed in they are treated as if they were s_double_list structures.

	The functions that call these list processing functions have
structures such as
	
		typedef struct element
		{
		   void *next;
		   void *prev;
		   char *name;
		   int type;
		   char *value;
		} s_element;

		typedef struct elem_buffer
		{
		   void *next;
		   void *prev;
		   char *handle;
		   int  is_modified;
		   int  is_deleted;
		   s_element *element_list;
		} s_elem_buffer;

What I need to know is, how portable are the list processing functions. 
They are based on the assumption that the first three fields of the 
list structures will be void *, void * and char *. Is this a valid assumption?
or can the order that fields are listed in a structure be changed by the
compiler?

--
=======================================================
Doug Olson		| P.O. Box 149149, M/S 2227	
Texas Instruments	| Austin, Texas, 78714-9149	
12501 Research Blvd	| olson at aaet.csc.ti.com		
=======================================================



More information about the Comp.lang.c mailing list