Hi.
I'm looking into bug#52079 (missing lcfirst function from function index).
The cause of the bug is that the genfunclist / genfuncindex scripts
haven't been run in a while.
Whilst running them and fixing a small issue with ereg => preg, I
notice that in the results of genfunclist, there are 3 different ways
to collect an extensions functions ...
- The majority use const (79 in total).
const zend_function_entry apache_functions[] = {
const zend_function_entry apache_functions[] = {
const zend_function_entry basic_functions[] = {
const zend_function_entry bcmath_functions[] = {
const zend_function_entry birdstep_functions[] = {
...
const zend_function_entry xsl_functions[] = {
const zend_function_entry zend_funcs_aggregate[] = {
const zend_function_entry zend_funcs_arrayaccess[] = {
const zend_function_entry zend_funcs_iterator[] = {
const zend_function_entry zend_funcs_serializable[] = {
- The following use static.
static zend_function_entry disabled_function[] = {
static zend_function_entry mysqlnd_functions[] = {
static zend_function_entry php_sqlite3_class_methods[] = {
static zend_function_entry php_sqlite3_result_class_methods[] = {
static zend_function_entry php_sqlite3_stmt_class_methods[] = {
static zend_function_entry spl_funcs_SplFixedArray[] = {
- The following don't use const or static.
zend_function_entry enchant_functions[] = {
zend_function_entry fileinfo_functions[] = {
zend_function_entry intl_functions[] = {
zend_function_entry litespeed_functions[] = {
zend_function_entry phar_exception_methods[] = {
zend_function_entry phar_functions[] = {
zend_function_entry php_archive_methods[] = {
zend_function_entry php_entry_methods[] = {
zend_function_entry php_oci_functions[] = {
Regards,
Richard.
--
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
My feeling is that they should all be static consts unless explicitly accessed outside of the object module or changed. Since typically they're a list of function/method entries only accessed by a class or zend_module_entry that is really the case. Without the static we're polluting the name space.
Melanie
Hi.
I'm looking into bug#52079 (missing lcfirst function from function index).
The cause of the bug is that the genfunclist / genfuncindex scripts
haven't been run in a while.Whilst running them and fixing a small issue with ereg => preg, I
notice that in the results of genfunclist, there are 3 different ways
to collect an extensions functions ...
- The majority use const (79 in total).
const zend_function_entry apache_functions[] = {
const zend_function_entry apache_functions[] = {
const zend_function_entry basic_functions[] = {
const zend_function_entry bcmath_functions[] = {
const zend_function_entry birdstep_functions[] = {
...
const zend_function_entry xsl_functions[] = {
const zend_function_entry zend_funcs_aggregate[] = {
const zend_function_entry zend_funcs_arrayaccess[] = {
const zend_function_entry zend_funcs_iterator[] = {
const zend_function_entry zend_funcs_serializable[] = {
- The following use static.
static zend_function_entry disabled_function[] = {
static zend_function_entry mysqlnd_functions[] = {
static zend_function_entry php_sqlite3_class_methods[] = {
static zend_function_entry php_sqlite3_result_class_methods[] = {
static zend_function_entry php_sqlite3_stmt_class_methods[] = {
static zend_function_entry spl_funcs_SplFixedArray[] = {
- The following don't use const or static.
zend_function_entry enchant_functions[] = {
zend_function_entry fileinfo_functions[] = {
zend_function_entry intl_functions[] = {
zend_function_entry litespeed_functions[] = {
zend_function_entry phar_exception_methods[] = {
zend_function_entry phar_functions[] = {
zend_function_entry php_archive_methods[] = {
zend_function_entry php_entry_methods[] = {
zend_function_entry php_oci_functions[] = {
Regards,
Richard.
--
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
On Mon, 14 Jun 2010 11:56:57 +0100, Melanie Rhianna Lewis
cyberspice@php.net wrote:
My feeling is that they should all be static consts unless explicitly
accessed outside of the object module or changed. Since typically
they're a list of function/method entries only accessed by a class or
zend_module_entry that is really the case. Without the static we're
polluting the name space.
The static keyword is unnecessary, const already makes the variable have
internal linkage by default.
--
Gustavo Lopes
I know the ANSI C standard pretty well but I don't remember that at all so rather than just accepting it I checked it on my Mac using a small example. Compiler details are below:
kring:Development melanie$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5657)
In my example static const did have internal linkage, const on its own in the global scope did not. You still need static.
Melanie
On Mon, 14 Jun 2010 11:56:57 +0100, Melanie Rhianna Lewis
cyberspice@php.net wrote:My feeling is that they should all be static consts unless explicitly accessed outside of the object module or changed. Since typically they're a list of function/method entries only accessed by a class or zend_module_entry that is really the case. Without the static we're polluting the name space.
The static keyword is unnecessary, const already makes the variable have internal linkage by default.
--
Gustavo Lopes
2010/6/14 Melanie Rhianna Lewis cyberspice@php.net:
I know the ANSI C standard pretty well but I don't remember that at all so rather than just accepting it I checked it on my Mac using a small example. Compiler details are below:
kring:Development melanie$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5657)In my example static const did have internal linkage, const on its own in the global scope did not. You still need static.
Right, "const" is not similar to "static const"!
+1 for static consts for all of them
Patrick
Melanie
On Mon, 14 Jun 2010 11:56:57 +0100, Melanie Rhianna Lewis
cyberspice@php.net wrote:My feeling is that they should all be static consts unless explicitly accessed outside of the object module or changed. Since typically they're a list of function/method entries only accessed by a class or zend_module_entry that is really the case. Without the static we're polluting the name space.
The static keyword is unnecessary, const already makes the variable have internal linkage by default.
--
Gustavo Lopes
On Mon, 14 Jun 2010 14:32:25 +0100, Melanie Rhianna Lewis
cyberspice@php.net wrote:
I know the ANSI C standard pretty well but I don't remember that at all
so rather than just accepting it I checked it on my Mac using a small
example. Compiler details are below:kring:Development melanie$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5657)In my example static const did have internal linkage, const on its own
in the global scope did not. You still need static.
You're right. I'd checked it here:
and some other place, but at least the C99 standard says otherwise.
--
Gustavo Lopes