function attributes
- From: "Matthias Clasen" <matthiasc poet de>
- To: <gtk-devel-list gnome org>
- Subject: function attributes
- Date: Fri, 5 Oct 2001 09:22:03 +0200
While extending the documentation of the gcc function attribute macros,
I found that many of the functions in glib which are marked as G_GNUC_CONST
are not actually const functions according to the definition found in the
GNU C manual
(http://gcc.gnu.org/onlinedocs/gcc-3.0.1/gcc_5.html#SEC93), since they are
either
derefencing pointer arguments or read global memory. These functions should
probably be
declared pure instead of const.
g_unichar_*, g_ascii_*, g_spaced_primes_closest, g_quark_to_string (these
access global memory)
g_int_equal (dereferences pointer arguments)
Furthermore, _glib_gettext could be marked as G_GNUC_FORMAT(1) and
g_malloc and friends and a lot of the functions returning newly-allocated
strings could
be marked G_GNUC_MALLOC after defining G_GNUC_MALLOC to be
__attribute__((malloc)).
I have put this in bugzilla as #61780.
Matthias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]