Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Different ways to collect an extension's functions. [RSS Feed]

#1 June 14, 2010 11:57:40

Melanie R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Different ways to collect an extension's functions.


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

On 14 Jun 2010, at 11:38, Richard Quadling wrote:

> 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 ...
>
> 1) 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 = {
>
>
> 2) 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 = {
>
>
> 3) 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>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 June 14, 2010 12:29:12

Gustavo L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Different ways to collect an extension's functions.


On Mon, 14 Jun 2010 11:56:57 +0100, Melanie Rhianna Lewis
<cybersp***@*hp.net> wrote:My feeling is that they should all be static consts unless explicitlyaccessed outside of the object module or changed. Since typicallythey're a list of function/method entries only accessed by a class orzend_module_entry that is really the case. Without the static we'repolluting the name space.The static keyword is unnecessary, const already makes the variable haveinternal linkage by default.--
Gustavo Lopes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 June 14, 2010 14:33:10

Melanie R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Different ways to collect an extension's functions.


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 14 Jun 2010, at 12:28, Gustavo Lopes wrote:

> On Mon, 14 Jun 2010 11:56:57 +0100, Melanie Rhianna Lewis
> <cybersp***@*hp.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
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 June 14, 2010 15:02:22

Patrick A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Different ways to collect an extension's functions.


2010/6/14 Melanie Rhianna Lewis <cybersp***@*hp.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 14 Jun 2010, at 12:28, Gustavo Lopes wrote:
>
>> On Mon, 14 Jun 2010 11:56:57 +0100, Melanie Rhianna Lewis
>> <cybersp***@*hp.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
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit:http://www.php.net/unsub.php>>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 June 14, 2010 15:15:12

Gustavo L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Different ways to collect an extension's functions.


On Mon, 14 Jun 2010 14:32:25 +0100, Melanie Rhianna Lewis<cybersp***@*hp.net> wrote:I know the ANSI C standard pretty well but I don't remember that at allso rather than just accepting it I checked it on my Mac using a smallexample. 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 ownin the global scope did not. You still need static.You're right. I'd checked it here:http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.langref.doc/as400clr16.htmand some other place, but at least the C99 standard says otherwise.

--
Gustavo Lopes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Different ways to collect an extension's functions. [RSS Feed]

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support