"Strong typing vs. strong testing"

Ian Collins ian-news at hotmail.com
Thu Sep 30 05:52:40 EDT 2010


On 09/30/10 09:02 PM, Paul Rubin wrote:
>
>      int maximum(int a, int b);
>
>      int foo() {
>        int (*barf)() = maximum;
>        return barf(3);
>      }
>
> This compiles fine for me.  Where is the cast?  Where is the error message?
> Are you saying barf(3) doesn't call maximum?

Try a language with stricter type checking:

CC /tmp/u.c
"/tmp/u.c", line 7: Error: Cannot use int(*)(int,int) to initialize 
int(*)().
"/tmp/u.c", line 8: Error: Too many arguments in call to "int(*)()".

-- 
Ian Collins



More information about the Python-list mailing list