I used the code in below link:
Readline Library
And I defined a struct like this
typedef struct {
char *name; /* User printable name of the function. */
Function *func; /* Function to call to do the job. */
char *doc; /* Documentation for this function. */
} COMMAND;
When I compile the code the compiler displays these warnings:
"Function is deprecated [-Wdeprecated-declarations]"
So what type should I change if I cannot use the function type?
Deprecated means the use of the name or entity declared with this attribute is allowed but discouraged for some reason. The compiler gives warnings and if string literals are provided, they are included in warnings.
It is dangerous because it provides no protection against overflowing the string into which it is saving data. Programs that use gets can actually be a security problem on your computer.
Therefore, the function gets was removed from the C standard library in 2011. The C11 version of <stdio. h> no longer contains a declaration for gets .
Function
is a typedef
(an alias of a pointer to function returning int
) marked as deprecated by the library:
typedef int Function () __attribute__ ((deprecated));
Just use:
typedef struct {
char *name; /* User printable name of the function. */
int (*func)(); /* Function to call to do the job. */
char *doc; /* Documentation for this function. */
} COMMAND;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With