[Prev][Next][Index]

Re: pc++ / printf problem



>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);

>NOTE the missing type for pCar_1 (which results in a C++ error).
>It works if "i" is declared "int", but not if declared "long",
>"unsigned", or "unsigned long".

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). 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?
And independent of your answer, I'll try to make the printf  
conversion more robust. --Beata