gnupic: Re: Segmentation fault ... possible solution
Subject:
Re: Segmentation fault ... possible solution
From:
Philip Restuccia ####@####.####
Date:
29 May 2002 14:01:44 -0000
Message-Id: <3CF4DCC4.61A98C27@nortelnetworks.com>
Scott Dattalo wrote:
>
> On Wed, 29 May 2002, Philip Restuccia wrote:
>
> > Robert Warner wrote:
> > >
> > > Ok, this works ...
> > >
> > > //void skip_space(void)
> > > void skip_space( int *prxout)
> > > {
> > > // int *prxout = &rxout; //RXWTest
> >
> > Again, like I stated in my reply to your previous post, this will work
> > (assuming rxout is global) only because rxout will have been initialized
> > to 0, as are all global variables that are not otherwise explicitly initialized.
>
> Actually, global variables are *not* implicitly initialized to zero by
> SDCC.
Ah; sorry. I was basing my reply on what is specified by the ANSI C standard.
I guess this accounts for Robert's statement in his first post that it fails, too,
if rxout is defined as a global.
So the problem is apparently just one of using an unitialized variable as an
array index.
Phil
--
Philip Restuccia
Senior Principal Software Engineer
Nortel Networks
####@####.####