Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <4.3.2.7.2.20000920124029.00af9b50@pop3.ng.nsis.com> X-Sender: john DOT doucette AT pop3 DOT ng DOT nsis DOT com X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Wed, 20 Sep 2000 12:40:48 -0300 To: cygwin AT sourceware DOT cygnus DOT com From: John Daniel Doucette Subject: gcc2.95.2-2: #pragma pack(0) ?? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Hello, I am doing unit testing on a PC of some embedded system software. I needed to find a way of ensuring a group of structures were packed (1 byte alignment). I didn't want to use -fpack-struct because it would cause system structures to be packed as well whic hseemed a little dangerous to me. __attribute__ ((packed)) would have to be placed with each of the many structures which would involve modifying my tested source. I ended up using #pragma pack(1), then including the header file, then #pragma pack(0). Pack(0) is supposed to reset the structure packing back to whatever the gcc default is (GNU gcc manual), however it gives you a compiler error. warning: Alignment must be a small power of two, not 0, in #pragma pack warning: malformed `#pragma pack' Can I assume that on a Win95 PC the default aligment is 4 byte? I ended up using #pragma pack(4) at the end of the structures instead of pack(0). See below for cygcheck output. i.e. header.h ======= struct s { char ch; long i; } struct r { char b; char c; long l; } source.c ======= #pragma pack(1) #include "header.h" #pragma pack(4) Cygnus Win95/NT Configuration Diagnostics Current System Time: Wed Sep 20 14:13:19 2000 Win95 Ver 4.0 build 67109975 B Path: /cygdrive/c/WINDOWS /cygdrive/c/WINDOWS/COMMAND /cygdrive/c/BC5/BIN /cygdrive/c/RCS/BINNT /cygdrive/c/DAP /cygdrive/c/PKWARE /cygdrive/c/UTILITY /cygdrive/c/DOS /cygdrive/c/BP/BIN /cygdrive/c/BITWARE /cygdrive/c/IAR/EXE /cygdrive/c/IAR/INC /usr/bin /cygdrive/c/JJMACKAY/MET_TALK /cygdrive/c/JJMACKAY/UTILITY /cygdrive/c/PROGRA~1/ULTRAE~1 SysDir: C:\WINDOWS\SYSTEM WinDir: C:\WINDOWS !C: = `C:\Program Files\Netscape\Communicator\Program' !D: = `D:\src\working\epurse\UnitTest\otproto' TMP = `/cygdrive/c/WINDOWS/TEMP' TEMP = `/cygdrive/c/WINDOWS/TEMP' PROMPT = `$p$g' WINBOOTDIR = `C:\WINDOWS' COMSPEC = `C:\WINDOWS\COMMAND.COM' CLASSPATH = `C:\Program Files\PhotoDeluxe 2.0\AdobeConnectables' LOGNAME = `JohnDoucette' TZ = `AST' GEMPLUS_LIB_PATH = `C:\WINDOWS\GEMPLUS' WINDIR = `C:\WINDOWS' BLASTER = `A220 I5 D1 H5 P330 T6' CMDLINE = `cygcheck -s -v -r' TERM = `cygwin' HKEY_CURRENT_USER\Software\Cygnus Solutions HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2 (default) = `/cygdrive' cygdrive flags = 0x00000020 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/ (default) = `C:/cygwin' flags = 0x00000000 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin (default) = `C:/cygwin/bin' flags = 0x00000000 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib (default) = `C:/cygwin/lib' flags = 0x00000000 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2 a: fd N/A N/A c: hd FAT32 3092Mb 40% CP UN JOHN_C d: hd FAT32 4102Mb 54% CP UN JOHN_D e: fd N/A N/A f: cd CDFS 622Mb 100% CP Audio CD g: net FAT32 2047Mb 0% CP UN DRIVE_C j: net FAT32 2047Mb 0% CP UN DRIVE_C C:\cygwin\bin /usr/bin user textmode C:\cygwin\lib /usr/lib user textmode C:\cygwin / user textmode Found: C:\cygwin\bin\bash.exe Found: C:\cygwin\bin\cat.exe Found: c:\BC5\BIN\cpp.exe Found: C:\cygwin\bin\cpp.exe Warning: c:\BC5\BIN\cpp.exe hides C:\cygwin\bin\cpp.exe Found: c:\WINDOWS\COMMAND\find.exe Found: C:\cygwin\bin\find.exe Warning: c:\WINDOWS\COMMAND\find.exe hides C:\cygwin\bin\find.exe Found: C:\cygwin\bin\gcc.exe Found: C:\cygwin\bin\gdb.exe Found: C:\cygwin\bin\ld.exe Found: C:\cygwin\bin\ls.exe Found: c:\BC5\BIN\make.exe Found: c:\UTILITY\make.exe Warning: c:\BC5\BIN\make.exe hides c:\UTILITY\make.exe Found: C:\cygwin\bin\sh.exe 385k 1998/05/01 C:\WINDOWS\SYSTEM\cygwinb19.dll - os=4.0 img=1.0 sys=4.0 "cygwinb19.dll" v0.0 ts=1998/3/11 0:04 83k 2000/06/11 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0 "cygitcl30.dll" v0.0 ts=2000/6/11 3:34 35k 2000/06/11 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0 "cygitk30.dll" v0.0 ts=2000/6/11 3:34 402k 2000/06/11 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0 "cygtcl80.dll" v0.0 ts=2000/6/11 3:30 5k 2000/06/11 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0 10k 2000/06/11 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0 "cygtclreg80.dll" v0.0 ts=2000/6/11 3:30 639k 2000/06/11 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0 "cygtk80.dll" v0.0 ts=2000/6/11 3:34 586k 2000/08/04 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0 "cygwin1.dll" v0.0 ts=2000/8/4 0:53 Cygwin DLL version info: dll major: 1001 dll minor: 4 dll epoch: 19 dll bad signal mask: 19005 dll old termios: 5 api major: 0 api minor: 26 shared data: 3 dll identifier: cygwin1 mount registry: 2 cygnus registry name: Cygnus Solutions cygwin registry name: Cygwin program options name: Program Options cygwin mount registry name: mounts v2 build date: Thu Aug 3 20:53:46 EDT 2000 CVS tag: cygwin-1-1-4 shared id: cygwin1S3 Use -h to see help about each section ================================== John Daniel Doucette, Sr. Software Designer J. J. MacKay Canada Limited Halifax R & D Office 1046 Barrington Street, 1st Floor Halifax, Nova Scotia Canada B3H 2R1 Phone 902.423.7727 x22 Fax 902.422.8108 Internet www . jjmackay . ca Email john . doucette @ jjmackay . ca ================================== -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com