0

Desde hace poco, la profesora de programacion nos ha dicho de agregarle al comando de compilacion de g++ -ansi, es decir, en vez de escribir:

g++ file1.cpp file2.cpp

ahora escribimos:

g++ -ansi file1.cpp file2.cpp

No encuentro por ningun lado para que cosa sirve y al utilizarlo por primera vez me da un error que dice que '::iswblank', using ::vfwscanf y otros no han sido declarados en mi carpeta de mingw.

Es esencial usar el -ansi? para que sirve?

1 respuesta 1

0

Siguiendo esta respuesta, esa opción -ansi busca que la compilación de GCC se ajuste al estándar ANSI. La documentación dice:

The original ANSI C standard (X3.159-1989) was ratified in 1989 and published in 1990. This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later in 1990. There were no technical differences between these publications, although the sections of the ANSI standard were renumbered and became clauses in the ISO standard. This standard, in both its forms, is commonly known as C89, or occasionally as C90, from the dates of ratification. The ANSI standard, but not the ISO standard, also came with a Rationale document. To select this standard in GCC, use one of the options -ansi, -std=c89 or -std=iso9899:1990; to obtain all the diagnostics required by the standard, you should also specify -pedantic (or -pedantic-errors if you want them to be errors rather than warnings)

De donde se puede inferir que -ansi equivale también a -std=c89. No es esencial pero garantiza que pueda usarse en otras máquinas con implementaciones de librerías que se ajusten al estándar eelgido.

Me da curiosidad la búsqueda que dices que hiciste, porque sale fácilmente el resultado de SO en inglés. Posiblemente buscaste gcc -ansi y los buscadores entienden eso como "todo lo de gcc SIN el término ansi". Esas opciones de ejecución por consola hay que ponerlas entre comillas siempre.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.