News for hackers. Stuff that matters.
Re:C puzzles by mikeash on Thursday November 10, 2016 @01:26PM (#12922845)
Strange. Here's my erroring code:

    int main()
    {
        int* p;
        p = (int*)wrapped_malloc(sizeof(int));
        *p = 10;
        return 0;
    }
    
    void *wrapped_malloc(int size) {
        return malloc(size);
    }
And the actual error:

    test.c:9:11: error: conflicting types for 'wrapped_malloc'
        void *wrapped_malloc(int size) {
              ^
    test.c:4:19: note: previous implicit declaration is here
            p = (int*)wrapped_malloc(sizeof(int));
Are you doing anything differently?
Re:C puzzles by abbeyj on Thursday November 10, 2016 @01:52PM (#12923089)
Try putting wrapped_malloc above main. Or at least declaring it above main.
Re:C puzzles by mikeash on Thursday November 10, 2016 @02:05PM (#12923204)
If it's above main then there's no longer an implicit prototype and you're no longer replicating the problem.
Re:C puzzles by asamy45 on Thursday November 10, 2016 @02:25PM (#12923387)
No, I am not sure why this happens.