News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

gets

Started by JimJoyce, January 23, 2014, 03:11:41 PM

Previous topic - Next topic

JimJoyce

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.

TimoVJL

#1
Quote from: 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'.
Use compiler -std:C99 and you see 'warning #2241: The function 'gets' is marked as deprecated.'
PellesC isn't C89 compiler.
QuoteCompatibility
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).
May the source be with you

Bitbeisser

To add to timovjl's reply, see the "notes" part on this page:

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

Ralf