static methods

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat Mar 24 16:34:22 EST 2001


Sat, 24 Mar 2001 13:11:43 -0500, Robin Thomas <robin.thomas at starmedia.net> pisze:

> In C, "static" has been overexploited such that it has many different
> meanings in different contexts that have nothing to do with being
> "static".

A recent example in C99:

       [#7] A declaration of a parameter as ``array of type'' shall
       be adjusted to ``qualified pointer to type'', where the type
       qualifiers (if any) are those specified within the [  and  ]
       of  the  array  type derivation.  If the keyword static also
       appears within the [ and ] of  the  array  type  derivation,
       then  for  each  call  to  the  function,  the  value of the
       corresponding actual argument shall provide  access  to  the
       first  element of an array with at least as many elements as
       specified by the size expression.

[...]

       [#21] EXAMPLE 5 The following are  all  compatible  function
       prototype declarators.

               double maximum(int n, int m, double a[n][m]);
               double maximum(int n, int m, double a[*][*]);
               double maximum(int n, int m, double a[ ][*]);
               double maximum(int n, int m, double a[ ][m]);

       as are:

               void f(double (* restrict a)[5]);
               void f(double a[restrict][5]);
               void f(double a[restrict 3][5]);
               void f(double a[restrict static 3][5]);

       (Note  that  the  last  declaration  also specifies that the
       argument corresponding to a in any call to f must be a  non-
       null  pointer  to  the  first  of at least three arrays of 5
       doubles, which the others do not.)

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list