I need a compiler for which I can set the standard mode of K & R C in the absence of the simultaneous possibility of using language extensions of other standards.
|
1 answer
I don’t know about K & R C itself (that is, the version described in the first edition of K & R C), but it seems to me that C89 (on which the second edition was written) is quite close.
GCC and Clang in C89 are able. It uses -std=c89 -pedantic-errors flags.
MinGW-w64 (GCC port for Windows, currently GCC 8.1) can be downloaded here: tyk .
But MSVC (Visual Studio), as I understand it, does not know how. In the manual there was a flag for choosing the standard C ++, but not C.
- As far as I understand, by K & R "int main (int argc, char ** argv) {return 0;}" should not be collected. And going. - Alexander Prokoshev
- C89 and C90 are already ANSI C, and K & R is something completely tube-like that existed before official standardization ... it’s not quite clear why OP needs him ... - Fat-Zer
- @AlexanderProkoshev Can you show where it is written there? There are examples everywhere with
main() {...}, and they are going to. But there seems to be no prohibition onint main(int argc, char **argv). - HolyBlackCat - four@ Vladimir Smirnov I would immediately study the latest version. Otherwise, then relearn. In general, from the new versions of C almost never remove features. You just have to replace
main() {...}withint main() {... return 0;}, and almost everything else is the same. - HolyBlackCat 8:49 pm - 2@ Vladimir Smirnov Oh, believe me, it is not necessary ... In order to drive a car, they do not begin to learn how to harness a horse. First learn to
int f(a,b) int a; char * b; { ...}int f(a,b) int a; char * b; { ...}int f(a,b) int a; char * b; { ...}, then to learn againint f(int a, char* b)? Or learn to writeint f(void)? Is it worth it - to learn "back" and not "forward"? - Harry
|