User forums > Using Code::Blocks
Configuring Code::Blocks to follow older standards of C.
93NickCousar:
I'm trying to do some of the practice exercises in Kernighan & Ritchies The C Programming Language (2nd Edition), which was published in 1988. Most of the practice problems do not output as intended. I'm not sure why, but I think it may have to do with the C standards that the GCC compiler follows. This book was almost certainly written before the C99 standard was implemented so I think that is what is causing some of the programs to not run properly. Anyways, I was wondering if there was some setting in Code::Blocks I could change that would allow for programs written with an older standard of C to still be compiled correctly. This dialog box in the Project>Build Options tab looks promising, but I don't know which box to check. Would changing any of these settings work?
online pic hosting
sodev:
Throw away that book and get a recent one. Unless you work in a museum and prepare an exhibition. You can try the lowest language revision CodeBlocks offers (the numbers are years, 90 == 1990, 11 == 2011), but im not sure if any non-ancient gcc implements that old standard of that book anymore.
But depending what not outputting as intended is i doubt the standard has do much of an influence, it does have an influence to get the programs to compile and not crash instantly.
stahta01:
Try "-std=c89" or "-std=c90" they are likely the oldest supported by most recent GCC compilers.
For better answer ask on a site that supports the compiler you are using.
Edit2: Offsite link added https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Standards.html#Standards
Tim S.
93NickCousar:
--- Quote from: sodev on September 17, 2018, 12:41:37 am ---Throw away that book and get a recent one.
--- End quote ---
Can you recommend a book for a first year CS student? Perhaps something that goes into the theory/rationale behind certain programming concepts, and how they are implemented in C? I could also use a good reference book for specific rules and syntax.
BlueHazzard:
Without telling us what errors you have we can not help you much, but it is very unlikely that your runtime problems come from different c standards. Maybe your book is accessing raw memory? If there are differences then it is a operating system thing. C standards make the most difference on compile time. On runtime all should behave the same (minus some weird bugs).
Navigation
[0] Message Index
[#] Next page
Go to full version