On Tue, 2014-07-29 at 21:13 +0200, Marek Polacek wrote:
> On Tue, Jul 29, 2014 at 02:58:03PM -0400, David Malcolm wrote:
> > This is possibly a dumb question, but what happens for a static local,
> > rather than an auto local? e.g.
> >
> > int *f (void)
> > {
> > static int i;
> > return &i;
> > }
>
> This is fine. The variable i has a static storage duration, so is allocated
> when the program begins and is deallocated when the program ends. There's
> only
> one instance of the variable i.
Sorry, by "what happens" I meant, "is a warning emitted?", and I see
Marc has answered that.- Re: Warn when returning the address of a temporary (midd... Jeff Law
- Re: Warn when returning the address of a temporary (midd... Richard Sandiford
- Re: Warn when returning the address of a temporary ... Marc Glisse
- Re: Warn when returning the address of a tempor... Andreas Schwab
- Re: Warn when returning the address of a te... Marc Glisse
- Re: Warn when returning the address of a temporary ... Marc Glisse
- Re: Warn when returning the address of a tempor... David Malcolm
- Re: Warn when returning the address of a te... Marek Polacek
- Re: Warn when returning the address of ... David Malcolm
- Re: Warn when returning the address of a te... Marc Glisse
- Re: Warn when returning the address of a te... Marc Glisse
