Author Topic: C 99  (Read 6602 times)

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
C 99
« on: March 18, 2007, 08:15:36 am »
I have the latest build March 17. So what I have to do to get the support for C99 in my C programs?

Offline Russell

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: C 99
« Reply #1 on: March 18, 2007, 08:27:39 am »
Not entirely sure whether this will help or not, also presuming you use mingw/gcc

1) rename all files to a .c extension
2) use -pedantic
3) check http://gcc.gnu.org/c99status.html for anything that you use that might be broken.

Offline AmR EiSa

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: C 99
« Reply #2 on: March 18, 2007, 12:08:13 pm »
1) rename all files to a .c extension

Why ?

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: C 99
« Reply #3 on: March 18, 2007, 03:53:36 pm »
Cannot get u all. Rename files to .C??? Why a C file have an extension other than .C

Should I have to turn any option on in compiler setting? I am using mingw.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: C 99
« Reply #4 on: March 18, 2007, 03:58:30 pm »
My guess, Russel assumed that you'll be using a filename with .c99 extension or so. I'm not sure, but I guess so. If you are using any such extension, then rename them to .c

Should I have to turn any option on in compiler setting? I am using mingw.

Yes, again from Russel's post, -pedantic compiler options should be used.

Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
HELP ONCE AGAIN !!!
« Reply #5 on: March 19, 2007, 09:15:52 am »
I have found in one book that following switches to be used...

-ansi Compiles programs that are standards compliant as well as
        the GNU extensions
-pedantic Issues warnings required by strict standards compliance
-std=c89 The ISO C89 standard
-std=C99 The ISO C99 standard
-std=gnu89 The ISO C89 standard with GNU extensions and someC99 features
-traditional Compiles with the original C syntax

But where should I set these switches in CODE BLOCKS?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C 99
« Reply #6 on: March 19, 2007, 09:29:07 am »
Actually if you want C99, then -std=c99 would be the right option.

--pedantic does not necessarily use C99 (it accidentially does on my system, but not necessarily on all systems, and not at all times in the future). What --pedantic does is "reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std option used.".

As a side note, please do note that gcc does not support C99 at all, only the corrected version from 2001 (it's still called C99, but not the same as "real" C99).

Also please be careful if you intend to:
Quote from: gcc documentation
Some users try to use -pedantic to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it finds some non-ISO practices, but not all—only those for which ISO C requires a diagnostic, and some others for which diagnostics have been added.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: C 99
« Reply #7 on: March 19, 2007, 01:01:28 pm »
But where to implement the switches in CODE BLOCKS? I am using GCC 4.1.2..Does not it support C99?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: C 99
« Reply #8 on: March 19, 2007, 02:19:58 pm »
But where to implement the switches in CODE BLOCKS?
The "Other options" tab in the Compiler settings section of your project's Build options.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C 99
« Reply #9 on: March 19, 2007, 02:32:25 pm »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline ANIRBAN GHOSH

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: C 99
« Reply #10 on: March 19, 2007, 06:19:30 pm »
THANK YOU VERY MUCH TO ALL OF YOU FOR THE GREAT SUPPORT