[perl #42313] improper casting to void * in src/dynext.c

1 view
Skip to first unread message

via RT

unread,
Apr 5, 2007, 11:22:55 AM4/5/07
to bugs-bi...@rt.perl.org
# New Ticket Created by
# Please include the string: [perl #42313]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42313 >


load_func is not a void pointer.

Index: src/dynext.c
===================================================================
--- src/dynext.c (revision 17994)
+++ src/dynext.c (working copy)
@@ -288,7 +288,7 @@
string_cstring_free(cinit_func_name);
}
else {
- load_func = (void *)NULL;
+ load_func = NULL;
init_func = NULL;
}


Leopold Toetsch

unread,
Apr 5, 2007, 7:01:27 PM4/5/07
to perl6-i...@perl.org, via RT, bugs-bi...@rt.perl.org

There is some usage of this cast ...

include/parrot/parrot.h:#define NULLfunc (funcptr_t)0

... around to silent picky compilers. (Yes, a NULL data ptr and function ptr
might be different, but ...)

leo

Nicholas Clark

unread,
Apr 6, 2007, 2:56:12 PM4/6/07
to Leopold Toetsch, perl6-i...@perl.org, via RT, bugs-bi...@rt.perl.org

One can't assign (void *) 0 to a function pointer.
It's not allowed under (strict) ANSI C (and therefore those picky compilers)
So that NULLfunc is correct. But personally I prefer assigning plain 0.


Nicholas Clark

Reply all
Reply to author
Forward
0 new messages