delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/01/08:03:24

From: apothegm AT no DOT spam DOT softcom DOT net (Nathan Thompson)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: struct in DJGPP
Date: Mon, 01 Sep 1997 04:07:29 GMT
Reply-To: apothegm AT no DOT spam DOT softcom DOT net
Message-ID: <340d3e00.424460@news.softcom.net>
References: <340A0B24 DOT 55B6E7F7 AT osu DOT edu>
MIME-Version: 1.0
NNTP-Posting-Host: 206.107.251.123
Lines: 42
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 31 Aug 1997 20:24:05 -0400, Mark Augustyn <augustyn DOT 3 AT osu DOT edu>
wrote:

>I hate to ask a dumb question but is this the appropriate way to declare
>a struct:
>
>struct cell {
> int terrain;
> BITMAP *tile;
>};

[snip]

>What am I missing?  Do I need to include something to use structs and
>classes?
>
>Please help before I seriously injure the wall with my head.
>Mark.
I had similar trouble when moving from Turbo C++ to DJGPP; evidently,
TC++ allows some seriously nonstandard C++ style code in C programs.

Anyway, here's a syntax I've found to work well (it's the same one
used in the Allegro source code, as that's how I figured out this
form):

typedef struct CELL {
 int terrain;
 BITMAP *tile;
} CELL;

/* then, later: */

CELL mycell;  /* or whatever */

The capitalization of 'CELL' is just my preference; C lets you
capitalize any way you like in this form just as it does elsewhere.

Hope that helps...

Nathan Thompson
---------------
Remove 'no.spam' to reply.

- Raw text -


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