Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Rob Quill" <rob.quill@gmail.com>
To: gdb@sourceware.org
Subject: Variable values before initialisaton
Date: Thu, 23 Nov 2006 17:32:00 -0000	[thread overview]
Message-ID: <baf6008d0611230932i7311457as19ee92b76832c2a8@mail.gmail.com> (raw)
In-Reply-To: <baf6008d0611230932o355f2ba6h9f6b0e778c82bce@mail.gmail.com>

How could I go about looking into a fix? I wouldn't really know where
to start, but it is quite annoying for what  am trying to do.

Thanks for your help.

Rob

On 23/11/06, Vladimir Prus <ghost@cs.msu.su> wrote:
> Rob Quill wrote:
>
> > Hi,
> >
> > Sorry to ask to many questions in one day. but I was wondering fi
> > anyone could explain why a variable can have a value before it has
> > been declared.
> >
> > In my code I have:
> >
> > int i = 0;
> > int j = 2;
> > int k = 3;
> >
> > and if I print the value of k any time before it has been set to 3, it
> > get it being equal to a very large number, rather than it not being in
> > the current scope. Is this a debugging thing, or something to do with
> > the way the code is compiled, or something else?
>
> You're extremely lucky you've int variables, and not C++ classes, and not
> trying to call member functions of those.
>
> The gdb/gcc combination has the bad habit of including not-yet-created
> variables in the list of local variables. I don't think anybody's working
> on a fix.
>
> - Volodya
>
>
>


  parent reply	other threads:[~2006-11-23 17:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 17:12 Rob Quill
2006-11-23 17:27 ` Vladimir Prus
     [not found]   ` <baf6008d0611230932o355f2ba6h9f6b0e778c82bce@mail.gmail.com>
2006-11-23 17:32     ` Rob Quill [this message]
2006-11-23 19:55       ` Daniel Jacobowitz
2006-11-23 19:58         ` Rob Quill
2006-11-24  6:53         ` Vladimir Prus
2006-11-24 15:15           ` Daniel Jacobowitz
2006-11-27 20:09             ` Jim Blandy
2006-11-28 11:21               ` Rob Quill
2006-11-28 19:29                 ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baf6008d0611230932i7311457as19ee92b76832c2a8@mail.gmail.com \
    --to=rob.quill@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox