delorie.com/archives/browse.cgi | search |
Xref: | news-dnh.mv.net comp.os.msdos.djgpp:2944 |
Path: | news-dnh.mv.net!mv!news.sprintlink.net!newsfeed.internetmci.com!in1.uu.net!jaxnet.jaxnet.com!news.atlcom.net!usenet |
From: | gt7010a AT prism DOT gatech DOT edu (Ojas Parekh) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Determining proper sizeof a struct |
Date: | Mon, 30 Oct 1995 19:24:02 GMT |
Organization: | Future Services, Inc. |
Lines: | 43 |
Nntp-Posting-Host: | lpm2-12.atlcom.net |
To: | djgpp AT sun DOT soe DOT clarkson DOT edu |
Dj-Gateway: | from newsgroup comp.os.msdos.djgpp |
#include <stdio.h> typedef unsigned short word; typedef unsigned char byte; typedef unsigned char bit; typedef struct { bit notval :1; bit isrequest :1; bit resumelater :1; bit hatched :1; } filstat; typedef struct { char filename[13]; char description[61]; short credits; word downloaded; byte sizemod; word blocks; word owner; char stowner[37]; char date[9]; word daten; long vpointer; filstat filestat; byte res[10]; } ulfrec; main() { printf("sizeof(ulfrec) = %li\n", sizeof(ulfrec)); } This program prints a value of 148 for sizeof(ulfrec) under both DJGPPV2 and DJGPP 1.12m4, but the value should be 146. Compiled under BC 3.1, this same program reports 146 for sizeof(ulfrec) as it should. Is there something about gcc/DJGPP data types that I am not aware of? Thanks. Ojas
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |