[Bug c/33219] Error in compiling when there is a function with a char parameter called before its declaration with inline parameters.

andreagrassi at sogeasoft dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 29 17:39:00 GMT 2007



------- Comment #11 from andreagrassi at sogeasoft dot com  2007-08-29 17:39 -------
Subject: R:  Error in compiling when there is a function with a char parameter
called before its declaration with inline parameters.

I accept the answer to gave me but then also the definition of

    a(a)
       char a;
    {
    ...

should be invalid. I don't understand why if I define

    a(char a)
    {
    ...

the compiler take a as "char" and don't match with promoted type giving me
an error whereas the other way the compiler promotes the "char a" to "int"
ALSO IN THE DEFINITION of the function !!
Why in summary

    a(a)
       char a;    // => promoted to int
    {
    ...

whereas

    a(char a)    // =>remains char
    {
    ...

The two manner defines the SAME THING (even if in 2 different forms) and
MUST be treated identically
(like for example "(*a).b" and "a->b" ).
You can tell me that your gcc works so, that your gcc treat differently the
2 cases,
I accept and I correct my code in order to success, but officially it isn't
correct.

Then, finishing, I don't understand because you must promote a parameter
EXPLICITLY rapresented by a char-constant as 'A' or by a variable previously
declared as char, or why, once promoted, you cannot re-correct the signature
!! The definition should override the implicitly signature .
I know it's from always so, but this is a twist of the logic of the
language.

However thanks to "raeburn at raeburn dot org" for his kindness, whereas I
cannot say so about you and Andrew Pinski, to whom I say to be kinder and to
try to develop a product and answer people using more his brain.




Le informazioni contenute in questo messaggio di posta elettronica sono di
natura confidenziale; qualsiasi pubblicazione, utilizzo o diffusione anche
parziale dello stesso non può essere effettuata senza autorizzazione e
potrebbe costituire un illecito penale ai sensi del Decreto Legs.vo N°
196/2003 sulla Protezione dei Dati Personali e del Codice Penale, Art.
617-621-635 bis oltre che della legge 547/93. Qualora non siate tra i
legittimi destinatari di questa e-mail Vi preghiamo cortesemente di
cancellarla dal Vostro sistema dopo aver notificato al mittente, rispondendo
alla comunicazione, l'errore da questi commesso.



> -----Messaggio originale-----
> Da: manu at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
> Inviato: mercoledì 29 agosto 2007 18.31
> A: andreagrassi@sogeasoft.com
> Oggetto: [Bug c/33219] Error in compiling when there is a
> function with
> a char parameter called before its declaration with inline parameters.
>
>
>
>
> ------- Comment #9 from manu at gcc dot gnu dot org
> 2007-08-29 16:30 -------
> Since "a" is called before being defined/declared is assumed:
>
> extern int a();
>
> See also: http://c-faq.com/decl/implfdecl.html
>
> The error message could be a bit clearer by pointing out this
> explicitly:
>
> a.c:7: error: conflicting types for 'a'
> a.c:7: note: an argument type that has a default promotion
> can't match an empty
> parameter name list declaration
> a.c:3: error: previous implicit declaration 'extern int a()'
> of 'a' was here
>
> But I doubt anyone would be interested to work on a patch for
> that. Would you?
>
>
> --
>
> manu at gcc dot gnu dot org changed:
>
>            What    |Removed                     |Added
> --------------------------------------------------------------
> --------------
>                  CC|                            |manu at gcc
> dot gnu dot org
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33219
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
>
>
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33219



More information about the Gcc-bugs mailing list