A lot of Perl XS code uses const char *
as the return value of an XS sub but never just char *
. For example:
const char *
version(...)
CODE:
RETVAL = chromaprint_get_version();
OUTPUT: RETVAL
code from xs-fun
Can someone explain why const
is preferred? In my testing, the returned scalar is modifiable whether const
is used or not.