freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <camber AT ais.org>
- To: TDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] portable constructions
- Date: Tue, 31 Dec 2002 19:34:24 -0500 (EST)
until you get bus errors on sparc and hp/ux for unaligned access. If
your going to change it back to a cast you need to make sure buffer is
aligned which may not be possible (comes unaligned in buffer from server).
We used to cast and moved to memcpy for that reason.
On Tue, 31 Dec 2002, James K. Lowden wrote:
> I often see code like this:
>
> CS_VOID * buffer;
> CS_INT int_val;
> memcpy(buffer, &int_val, sizeof(CS_INT));
>
> I wouldn't use memcpy(). I would cast it:
>
> *(CS_INT*) buffer = int_val;
>
> Is there some reason not to do that? Surely my code is easier to
> understand and requires fewer instructions.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
-
[freetds] portable constructions,
James K. Lowden, 12/31/2002
- Re: [freetds] portable constructions, Michael Peppler, 12/31/2002
- Re: [freetds] portable constructions, Brian Bruns, 12/31/2002
Archive powered by MHonArc 2.6.24.