cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/16/15:16:29

From: "Lars Hansen" <lars DOT o DOT hansen AT gmx DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: sizeof(struct x) doesn't compile -- how to do it ?
Date: Thu, 16 Jan 2003 21:00:40 +0100
Organization: 1&1 Internet AG
Lines: 33
Message-ID: <b07318$3eg$1@news.online.de>
NNTP-Posting-Host: p5083812e.dip0.t-ipconnect.de
X-Trace: news.online.de 1042747240 3536 80.131.129.46 (16 Jan 2003 20:00:40 GMT)
X-Complaints-To: abuse AT online DOT de
NNTP-Posting-Date: 16 Jan 2003 20:00:40 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

#include "stdlib.h"

struct x
 {
  double x;
 };

int main()
 {
  x* n=malloc(2*sizeof(struct x));
 }


produces the following compiler error message:

test.c: In function `main':
test.c:10: `x' undeclared (first use in this function)
test.c:10: (Each undeclared identifier is reported only once
test.c:10: for each function it appears in.)
test.c:10: `n' undeclared (first use in this function)


So how do I get the size of structs with djgpp?


And also: if i have an array of a struct with several elements how can i know
at which byte an element of the nth struct is in that array with djgpp (eg
after writing a struct array to file and then loading this data without
knowing how to "synchronize" djgpps compiler struct array generation and
saving and an other compilers array struct generation and loading means one
best knows the byte position (and length))


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019