[Tinyos-help] Dangling pointer in SF (C version)

Daniel Widyanto danielw at wireless-people.com
Wed Oct 24 18:57:28 PDT 2007

Hi all,

Sorry, my mistake. 

I didn't realize the :"typedef struct serial_source *serial_source;"
in serialsource.h

And thanks for the "x = malloc(sizeof *x)" tip.



-------- Original Message --------
> From: "David Gay" <dgay42 at gmail.com>
> Sent: Thursday, October 25, 2007 12:32 AM
> To: "Michael Schippling" <schip at santafe.edu>
> Subject: Re: [Tinyos-help] Dangling pointer in SF (C version)
> On 10/23/07, Michael Schippling <schip at santafe.edu> wrote:
> > If "serial_source" has been typedefed to be a pointer,
> > which is what the subsequent usage tends to indicate,
> > then this _should_ allocate and init a block of whatever
> > rather than just a pointer. If that is the case then it
> > seems to be a poor naming choice. You'll have to chase
> > the dragon further up the tree to see what it really is...
> I'll point out that if you write "x = malloc(sizeof *x)", you're
> guaranteed to get something of the size of whatever x is declared to
> point to, irrespective of any changes anywhere else in the program
> (ok, making x a non-pointer will cause a compile-time error). Seems:
> a) pretty clear, b) pretty reliable.
> David Gay
> >
> > MS

More information about the Tinyos-help mailing list