From: Eli Zaretskii <eliz@gnu.org>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC - Python Scripting] New method Value.referenced_value to dereference pointer as well as reference values (with docs)
Date: Tue, 13 Mar 2012 19:11:00 -0000 [thread overview]
Message-ID: <83pqcgwc2w.fsf@gnu.org> (raw)
In-Reply-To: <CAGyQ6gyJAw37dBWZHidvoVdGDhL83uD3bsNKyH5-jG2o_qEysw@mail.gmail.com>
> Date: Tue, 13 Mar 2012 17:23:54 +0530
> From: Siva Chandra <sivachandra@google.com>
>
> Per Tom's suggestion in another thread (see for reference
> http://sourceware.org/ml/gdb-patches/2012-03/msg00417.html), I have
> added a new method to gdb.Value. I am starting a new mail thread as
> the subject line, and the patch, have changed quite a bit from last
> time.
Thanks.
> +A similar function @code{Value.referenced_value} exists which also
> +returns @code{gdb.Value} objects corresonding to the values pointed to
> +by pointer values (and additionally, values referenced by reference
> +values). However, the behaviour of @code{Value.dereference}
^^^^^^^^^
Please use the US spelling ("behavior"), here and elsewhere in your
patch.
> +differs with @code{Value.referenced_value} by the fact that the
^^^^^^^^^^^^
"differs from"
> +behaviour of @code{Value.dereference} is identical to applying the C
> +unary @code{*} operator on a given value. For example, consider a
^^^^^^^^^^^^^^^^^^^^^^^
"unary operator `*'" sounds better. (There are more occurrences of
this in the patch.)
> +reference to a pointer @code{ptrref}, declared in your C++ program as
We use C@t{++} instead of C++, the former looks better in print.
> +@smallexample
> +typedef int *intptr;
> +...
> +int val = 10;
> +intptr ptr = &val;
> +intptr &ptrref = ptr;
> +@end smallexample
> +
> +Though @code{ptrref} is a reference value, one can apply the method
> +@code{Value.dereference} on the @code{gdb.Value} object corresponding
^^
"apply ... to"
> +corresponding to @code{ptr}. In general, @code{Value.dereference} can
> +be applied whenever the C unary @code{*} operator can be legally applied
> +to the corresponding C value.
GNU coding standards frown on using "legally" for anything that
doesn't refer to laws. Please just drop that word, it doesn't add any
important information in this context.
> For those cases where applying both
> +@code{Value.dereference} and @code{Value.referenced_value} is legal, the
^^^^^
Here, I would use "allowed" or "possible" instead of "legal".
> +results obtained need not be identical (as we have seen in the above
> +example). The results are however identical when applied on
> +@code{gdb.Value} objects corresponding to pointers (@code{gdb.Value}
> +objects with type code @code{TYPE_CODE_PTR}) in a C/C++ program.
^^^
C@t{++}
> +values. For example, consider a reference to an @code{int}, declared
> +in your C++ program as
And here.
> +@smallexample
> +int val = 10;
> +int &ref = val;
> +@end smallexample
> +
> +then applying @code{Value.dereference} on the @code{gdb.Value} object
^^
You want @noindent before this line. And "to", not "on".
OK with those changes, as far as the documentation is concerned.
next prev parent reply other threads:[~2012-03-13 19:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 11:54 Siva Chandra
2012-03-13 19:11 ` Eli Zaretskii [this message]
2012-03-14 10:28 ` Siva Chandra
2012-03-14 17:52 ` Eli Zaretskii
2012-03-14 18:07 ` Siva Chandra
2012-03-15 20:51 ` Tom Tromey
2012-03-22 9:12 ` Siva Chandra
2012-03-14 15:48 ` Tom Tromey
2012-03-14 17:26 ` Siva Chandra
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=83pqcgwc2w.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=sivachandra@google.com \
/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