Flavius
Flavius

Reputation: 13816

warning: parameter names (without types) in function declaration [enabled by default]

This typedef works:

typedef void (*mem_deallocator)(void*);

However this one

typedef void* (*mem_allocator)(size_t);

gives the warning:

warning: parameter names (without types) in function declaration [enabled by default]

I'm using GCC 4.8.1 and I'm compiling with -c -Wall.

How to fix the code so I won't get the warning any more?

Upvotes: 4

Views: 7889

Answers (1)

Yu Hao
Yu Hao

Reputation: 122363

size_t is defined in the following headers, you need to include at least one of them.

#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>   //since C99
#include <uchar.h>   //since C11

Upvotes: 6

Related Questions