Skip to Content.
Sympa Menu

freetds - Re: Example source codes

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Schaal <mark AT champ.tstonramp.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Example source codes
  • Date: Thu, 2 Sep 1999 10:09:49 -0700 (PDT)


>
> Mark,
>
> Is HW_BIG_ENDIAN a good way to check if we need to do a memcpy or use a
> cast? If memory serves, Alpha tends not to like unaligned access as well
> and is little endian. Does anyone know if there is a way to determine
> alignment boundries? (I think perl does this during its config). Is
> there an autoconf macro to do this that we should be checking for?
>
> Brian

No, I would say it's a terrible way to check. :-) I will look into
the perl config eventually, if no-one else gets to it. I've never
dealt with alignment problems and I was only guessing as to what was
happening there. I was happy enough to get something working that
didn't rely on having a longlong type.

Could one use something like the following and see if it dies with SIGBUS ?

int main()
{
char c[6];
long l1,l2;

memset(c,'\0',6);
l1 = *(long *)c;
l2 = *(long *)(c+2);
exit((int)(l1+l2));
}

Mark
--
Mark J. Schaal Phone: (909) 620-7724
TST On Ramp Fax: (909) 620-8174
System Administrator E-Mail: mark AT tstonramp.com




Archive powered by MHonArc 2.6.24.

Top of Page