summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2009-03-29 22:03:13 +0100
committerDavid Mitchell <davem@iabyn.com>2009-03-29 22:32:18 +0100
commitcf3f0ffbff208944549640df283e3008d1b83d77 (patch)
tree9b9a0185a339a7619a678e8a4bccc65ee9e57608 /handy.h
parent2a8f410418d535022b9d9c826afce2be4b335b47 (diff)
downloadperl-cf3f0ffbff208944549640df283e3008d1b83d77.tar.gz
provide minimal documentation for the MUTABLE_*() macros
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/handy.h b/handy.h
index 26a41a5ef0..9e8f50a30b 100644
--- a/handy.h
+++ b/handy.h
@@ -48,6 +48,15 @@ Null SV pointer. (No longer available when C<PERL_CORE> is defined.)
#define TRUE (1)
#define FALSE (0)
+/* The MUTABLE_*() macros cast pointers to the types shown, in such a way
+ * (compiler permitting) that casting away const-ness will give a warning;
+ * e.g.:
+ *
+ * const SV *sv = ...;
+ * AV *av1 = (AV*)sv; <== BAD: the const has been silently cast away
+ * AV *av2 = MUTABLE_AV(sv); <== GOOD: it may warn
+ */
+
#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
# define MUTABLE_PTR(p) ({ void *_p = (p); _p; })
#else