delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/14/08:30:55

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trouble with many mallocs and reallocs
Date: Wed, 12 Aug 1998 23:39:07 -0300
Organization: NBTel Internet
Lines: 36
Message-ID: <35D251CA.BC94C40F@unb.ca>
References: <199808120355 DOT EAA08180 AT sable DOT ox DOT ac DOT uk>
NNTP-Posting-Host: fctnts10c24.nbnet.nb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

George Foot wrote:

> On 11 Aug 98 at 17:28, Endlisnis wrote:
>
> > Bruno Barberi Gnecco wrote:
> >
> > > struct node {
> > >   struct node *forward, *back;
> > >   unsigned char *data;
> > >   };
> > > typedef struct node NODE;
> >
> >     Why do you use a typedef to reference 'node' as 'NODE'?
> > node a;   //SAME AS
> > NODE a;
> He didn't, he typdeffed `struct node' as `NODE'.
> > PS:  You don't need to use the word 'struct' when declaring node pointers, you can
> > just say node*.
>
> In C++ that is true, but in C you need an explicit typedef before you
> can do that.

    I didn't actually know that (I've never actually coded for a compiler that didn't
understand C++), but even given that information, there was a portion of his code that
went like "node* something", NOT using the typedef, so he was obviously compiling for
C++ or that wouldn't have worked.

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca




- Raw text -


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