Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7092431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:18:45+00:00 2026-05-28T08:18:45+00:00

What GCC options should be set to have GCC as strict as possible? (and

  • 0

What GCC options should be set to have GCC as strict as possible? (and I do mean as strict as possible) I’m writing in C89 and want my code to be ANSI/ISO compliant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:18:46+00:00Added an answer on May 28, 2026 at 8:18 am

    I’d recommend using:

    -Wall -Wextra -std=c89 -pedantic -Wmissing-prototypes -Wstrict-prototypes \
        -Wold-style-definition
    

    You should compile with -O as well as -g as some warnings are only available when the optimizer is used (actually, I usually use -O3 for spotting the problems). You might prefer -std=gnu89 as that disables fewer extensions in the libraries. OTOH, if you’re coding to strict ANSI C89, maybe you want them disabled. The -ansi option is equivalent to -std=c89 but not quite as explicit or flexible.

    The missing prototypes warns you about functions which are used (or external functions defined) without a prototype in scope. The strict prototypes means you can’t use ’empty parentheses’ for function declarations or definitions (or function pointers); you either need (void) or the correct argument list. The old style definition spots K&R style function definitions, such as:

    int old_style(a, b) int a; double b; { ... }
    

    If you’re lucky, you won’t need to worry about that. I’m not so lucky at work, and I can’t use strict prototypes, much to my chagrin, because there are too many sloppy function pointers around.

    See also: What is the best command-line tool to clean up code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

gcc 4.4.2 c89 I have the following enum: enum drop_options_e { drop_ssm, drop_snm, drop_ssb
Is there a set of command-line options that will convince gcc to produce a
I have the following code. Basically I want to initialize a std::array of non-POD
I have a portable code running on Visual C++ 2008 and RHEL 5.3 (gcc
I recently added -pedantic and -pedantic-errors to my make GCC compile options to help
I was bored and playing around with various options to gcc to see what
The gcc -S option will generate assembly code in AT&T syntax, is there a
When compiling shared libraries in gcc the -fPIC option compiles the code as position
Which option should be enabled in gcc to generate 16-bit or 32-bit or 64-bit
I need to set additional options for C compiler, e.g. add flag to turn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.