From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,98222358e072145,start X-Google-Attributes: gidfc89c,public X-Google-Thread: 1164f8,98222358e072145,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-07-11 12:51:45 PST Xref: gmd.de comp.sys.dec:8654 comp.unix.programmer:7435 Path: gmd.de!newsserver.jvnc.net!darwin.sura.net!news-feed-2.peachnet.edu!concert!samba.oit.unc.edu!gibbs.oit.unc.edu!tsnee From: tsnee@gibbs.oit.unc.edu (Tom Snee) Newsgroups: comp.sys.dec,comp.unix.programmer Subject: Re: Pointer alignment/unaligned data access problem with [g]dbm [SUMMARY] Date: 11 Jul 1993 19:43:43 GMT Organization: University of North Carolina at Chapel Hill Distribution: world Message-ID: <21pqhf$1de@samba.oit.unc.edu> NNTP-Posting-Host: gibbs.oit.unc.edu Summary: use memcpy() when using data returned by [g]dbm Keywords: SUMMARY Many thanks to the people who responded to my posting: Ted Stockwell of Aggregate Computing, Matt Day of Lachman Technology, Michael Corrigan of UCSD, and Alan Rollow of DEC. The consensus seems to be that dbm and gdbm do not properly align the data blocks that they return. The easiest solution is to use memcpy() to copy the data returned by [g]dbm into a structure, instead of casting the [g]dbm char * to structure *. When I tried it, lint still warned of "possible pointer alignment problem"s, but I did not get any runtime warnings. Thanks again. Tom Snee