G_CONST_RETURN
- From: Havoc Pennington <hp redhat com>
- To: gtk-devel-list gnome org
- Subject: G_CONST_RETURN
- Date: 22 Nov 2000 00:05:12 -0500
Hi,
Patch adds G_CONST_RETURN which is configurable by app programmers to
be either 'const' or empty. I used G_CONST_RETURN instead of simply
G_CONST because the macro is intended to let app programmers decide
whether return values are const. It shouldn't be used in other
situations, e.g. for const function arguments. Plain G_CONST seems to
invite confusion (e.g. the Tk source code uses CONST in place of const
in all cases, for portability to K&R compilers or something).
Will commit this if there are no objections; then we need to add
-DG_DISABLE_CONST_RETURNS to all the glib/GTK/pango builds to avoid
deluge-of-warnings, and go through and add G_CONST_RETURN to all
gchar* returns that shouldn't be freed.
Havoc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glib/ChangeLog,v
retrieving revision 1.542
diff -u -u -r1.542 ChangeLog
--- ChangeLog 2000/11/21 15:27:43 1.542
+++ ChangeLog 2000/11/22 05:00:30
@@ -1,3 +1,8 @@
+2000-11-21 Havoc Pennington <hp pobox com>
+
+ * gmacros.h: Provide G_CONST_RETURN which is 'const' by
default,
+ and nothing when G_DISABLE_CONST_RETURNS is defined.
+
2000-11-21 Sebastian Wilhelmi <wilhelmi ira uka de>
* configure.in: Add a surrogate for thread priorities using
PID
Index: gmacros.h
===================================================================
RCS file: /cvs/gnome/glib/gmacros.h,v
retrieving revision 1.1
diff -u -u -r1.1 gmacros.h
--- gmacros.h 2000/10/12 11:52:07 1.1
+++ gmacros.h 2000/11/22 05:00:30
@@ -175,4 +175,14 @@
# endif
#endif
+/* Allow the app programmer to select whether or not return values
+ * (usually char*) are const or not. Don't try using this feature
for
+ * functions with C++ linkage.
+ */
+#ifdef G_DISABLE_CONST_RETURNS
+#define G_CONST_RETURN
+#else
+#define G_CONST_RETURN const
+#endif
+
#endif /* __G_MACROS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]