Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

provide minimal documentation for the MUTABLE_*() macros

  • Loading branch information...
commit cf3f0ffbff208944549640df283e3008d1b83d77 1 parent 2a8f410
@iabyn iabyn authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 handy.h
View
9 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

0 comments on commit cf3f0ff

Please sign in to comment.
Something went wrong with that request. Please try again.