RE: Example in Docs: GPOINTER_TO_INT
- From: "Dmitry Ponomaryov" <eagleowl comail ru>
- To: "Havoc Pennington" <gtk-app-devel-list gnome org>
- Subject: RE: Example in Docs: GPOINTER_TO_INT
- Date: Fri, 27 Jul 2001 20:54:12 +0400
Here's the selection out of Pennington
(http://www.andamooka.org/reader.pl?pgid=ggadcha_glib):
There are also many macros unique to glib, such as the portable
gpointer-to-gint and gpointer-to-guint conversions shown in Figure 2.
...
Be careful, though; these macros allow you to store an integer in a
pointer,
but storing a pointer in an integer will not work.
What does "but storing a pointer in an integer will not work" here mean?
Macros GPOINTER_TO_INT(p) is `#define GPOINTER_TO_INT(p) ((gint)
${glib_gpi_cast} (p))`
and `glib_gpi_cast` is empty ''" or glong.
So it always works! but may return ugly rezult. Am I right?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And _imho_ usign of macro GPOINTER_TO_INT and GINT_TO_POINTER will not add
more portability to code _now_ and _may_ add more portability in the
_future_.
Am I right?
---
Dmitry Ponomaryov
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]