C problem...se megethos domhs
V13
v13 at priest.com
Sun Jan 25 02:37:38 EET 2004
On Sunday 25 January 2004 00:52, John Tsiombikas (Nuclear / the Lab) wrote:
> stin C :
> ---------------
> void koko(void);
> simenei oti i synartisi den pairnei kanena argument.
>
> void koko();
> simenei oti i synartisi mporei na parei otidipote plithos i arithmo
> arguments, aplos o compiler den elenxei ti pernas stin synartisi
> (apenergopoiei to checking ousiastika).
Periergo... Den to'ksera ayto.. Ayto poy *nomizo* oti eixa dei kapoy itan to:
void koko();
void lala(void) { koko(1); }
void koko(int a) {....}
opoy h dilosh ths synartisis mporei na einai adeia, alla oxi sto orismo tis...
Me ligo psaksimo brika kai ena bug report sto gcc (8 Jun 2002, id: c/6968) poy
leei akribos ayto:
-----
I might be reading this wrong but does not:
An identifier list declares only the identifiers of the parameters of the
function. An empty list in a function declarator that is part of a definition
of that function specifies that the function has no parameters. The empty
list in a function declarator that is not part of a definition of that
function specifies that no information about the number or types of the
parameters is supplied.124)
( ISO 9899:1999 Section 6.7.5.3 Paragraph 14 )
mean that in c99 void test() is a function that takes no arguments since
enmpty identifier list is part of the function definition and as such the
void test() example should produce an error in c99, but doesn't in gcc 3.1
using -std=c99
-----
Episis brika mia paragrafo poy leei kati diaforetiko:
"You can also define a function and not provide argument information. (Do not
use this capability in programs that you write: It is retained in Standard C
only to support programs written in older C dialects.)"
kai to:
-----
Empty function prototypes are a deprecated feature in C99 (as they were in
C89).
[C99: §6.7.5.3]
-----
Fenetai pos stin C99 exei pragmati alaksei h symperifora toy (), an kai to gcc
den kanei kati tetoio, eno tha eprepe na petaei warning me to -Wall...
:::::::::::::
Kapoy edo brika to C99 standard (ISO/IEC 9899:1999(E)) to opoio leei kathara
ayto poy egrafe sto bug report:
6.7.5.3, p.14: "An empty list in a function declarator that is part of a
definition of that function specifies that the function has no parameters"
To opoio exei ena footnote me arithmo 124 poy leei: See "future language
directions" (6.11.6)
kai to 6.11.6 grafei:
6.11.6 Function declarators
The use of function declarators with empty parentheses (not prototype-format
parameter type declarators) is an obsolescent feature.
Episis den katalabeno pos olo ayto mporei na prokalesei problima stin stiva
mias kai sto C calling convention o caller apothikeyei, metabalei kai
epanaferei ton stack pointer (kai fysika pernaei tis parametroys stin
stiba)...
> -- Nuclear / the Lab --
<<V13>>
More information about the Linux-greek-users
mailing list