[Prev][Next][Index]
Re: pc++ / printf problem
- From: "Bernd W. Mohr" <mohr@cs.uoregon.edu>
- Subject: Re: pc++ / printf problem
- To: bfatyga@slab.cica.indiana.edu (Beata Winnicka)
- Date: Wed, 1 Feb 1995 13:52:38 -0800 (PST)
- Cc: nate@skinner.cs.uoregon.edu,
sage-bugs@cica.cica.indiana.edu (Sage++ Bugs Mailinglist)
- In-Reply-To: <9502012143.AA05265@skinner.cs.uoregon.edu> from "Beata Winnicka" at Feb 1, 95 04:34:35 pm
> >a student of us found the following problem:
> >he has the following lines in his test.pc in Processor_Main:
> >
> > unsigned long i;
> >
> > printf ("i = %d\n");
>
> I assume you wanted to say:
>
> printf ("i = %d\n", i);
Oops. yes.
> I thought that if you omit a type in a function definition, then the
> compiler has to make the type int (a left-over from C).
I don't think so. This rule doesn't apply to parameters, I think it is just
the return type of functions.
Also this would be wrong as "int != long != unsigned ...." !!
> So it should
> not be an error (a warning, at most). Just because I am curious about
> that: what kind of error message do you get?
CC: "temp.C", line 30: error: argument declaration syntax (1466)
CC: "temp.C", line 30: error: syntax error (1502)
CC: "temp.C", line 30: error: syntax error (1502)
CC: "temp.C", line 30: error: syntax error (1502)
CC: "temp.C", line 31: error: syntax error (1502)
CC: "temp.C", line 31: error: syntax error (1502)
CC: "temp.C", line 31: error: syntax error (1502)
CC: "temp.C", line 31: error: syntax error (1502)
CC: "temp.C", line 31: error: syntax error (1502)
CC: "temp.C", line 31: error: bad declaration of pcxx_inpar -- did you
forget a ';'? (1493)
CC: "temp.C", line 31: error: two definitions of ::pcxx_inpar (1034)
CC: "temp.C", line 31: error: syntax error (1502)
CC: "temp.C", line 32: error: syntax error (1502)
CC: "temp.C", line 33: error: illegal reference to argument pCar_0 in
default argument (1678)
CC: sorry, too many errors
make: *** [temp.o] Error 1
and here is the part of temp.C:
30 int pcxx_printf17(char *pCar_0, pCar_1){
31 if ((pcxx_NodeNumber() == 0) || pcxx_inpar)
32 {
33 printf(pCar_0, pCar_1);
34 }
35 return 1;
36 }
Bernd
--
Bernd Mohr -- mohr@cs.uoregon.edu -- http://www.cs.uoregon.edu/~mohr
Sometimes I think the surest sign that intelligent life exists elsewhere in
the universe is that none of it has tried to contact us. -- Calvin