Mail Archives: djgpp/1998/08/14/08:30:55
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 -