tobold.org

correct • elegant • free

△ Comp.lang.c △

◅ Structure problem

Problems with the & and && operators ▻

Structure problem

In article <87eo6f$7a7$1@nnrp1.deja.com>,  <mikesta@my-deja.com> wrote:
>Is there any way I can force the structure to be
>14 bytes with the given structure elements.

No.  But you can use that structure if you're prepared to write
special-purpose routines to read and write it.  This will give you
complete control over what's going on, and gives you some chance of
porting your code.

>This would make it elegant as I could access an
>integer in the structure simply. The other way I
>can proceeed is with the following structure altho
>it is not as elegant for accessing integers,

I think your problem's a bit more fundamental than "elegance".  Have you
considered big-endian versus little-endian problems, for example?

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.lang.c
Subject: Re: Structure problem
Date: 4 Feb 2000 16:23:11 -0000
Message-ID: <87eue5$asu$1@ltpcg.star.le.ac.uk>
References: <87c8dc$fjr$1@nnrp1.deja.com>
  <87cc7s$6ns$1@ltpcg.star.le.ac.uk> <87eo6f$7a7$1@nnrp1.deja.com>

△ Comp.lang.c △

◅ Structure problem

Problems with the & and && operators ▻