Re: ALIGNOF_CORBA_* defines



Hi Wim,

On Wed, 14 Feb 2001, Wim Oudshoorn wrote:
> If I look at the global config.h file that the
> configure script spits out I notice the following block
> defines:
> 
> #define ALIGNOF_CORBA_BOOLEAN 1
> ...
> #define ALIGNOF_CORBA_DOUBLE 4
> 
> I don't know what the maning of these defines
> is, but if I compare it with the CORBA GIOP specification
> I see that that asks for

	These alignment constants are those used internaly by the compiler
to layout C structures, they differ per architecture so - for example for
the following structure:

typedef struct {
	char   a;
	double b;
	int    c;
} MyStruct;

	If I have a pointer:

	MyStruct *s -> a MyStrut instance.

	Then to get a double * to point to b I need to do something like
this:

#define ALIGN_ADDRESS(this, boundary) \
  ((gpointer)((( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))))

	gpointer p = ((guchar *)s + sizeof (char));

	double *d = ALIGN_ADDRESS (p, ALIGNOF_CORBA_DOUBLE);


	So, to work out the correct values for you, you need to consider
your processor architecture, and compiler.

	HTH,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]