Pelles C forum

C language => Expert questions => Topic started by: JimJoyce on January 23, 2014, 03:11:41 pm

Title: gets
Post by: JimJoyce on January 23, 2014, 03:11:41 pm
Is there a problem with stdio.h? Or is it just gets()?
When I use gets() the compiler throws a warning #2018:
Undeclared function 'gets;' assuming 'extern' returning 'int'.

If I add my own prototype: ' char* gets ( char* );'  it compiles OK.
Title: Re: gets
Post by: TimoVJL on January 23, 2014, 03:53:08 pm
Is there a problem with stdio.h? Or is it just gets()?
When I use gets() the compiler throws a warning #2018:
Undeclared function 'gets;' assuming 'extern' returning 'int'.
Use compiler -std:C99 and you see 'warning #2241: The function 'gets' is marked as deprecated.'
PellesC isn't C89 compiler.
Quote
Compatibility
The most recent revision of the C standard (2011) has definitively removed this function from its specification.
The function is deprecated in C++ (as of 2011 standard, which follows C99+TC3).
Title: Re: gets
Post by: Bitbeisser on January 24, 2014, 03:05:29 am
To add to timovjl's reply, see the "notes" part on this page:

http://en.cppreference.com/w/c/io/gets

Ralf