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 8007041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:42:16+00:00 2026-06-04T17:42:16+00:00

I have an example flawed program that should give exactly one warning about an

  • 0

I have an example flawed program that should give exactly one warning about an uninitialized variable, but when I compile it gcc doesn’t give me any warnings.

Here is the code:

#include <stdio.h>

int main()
{
    int foo;

    printf("I am a number: %d \n", foo);

    return 0;
}

Here is what I run: cc -Wall testcase.c -o testcase

And I get no feedback. As far as I know this should produce:

testcase.c: In function 'main': 
testcase.c:7: warning: 'foo' is used uninitialized in this function

It appears to warn Zed Shaw correctly in a similar example in his C tutorial). This is the example I had first tried and noticed that it wasn’t working as expected.

Any ideas?

EDIT:

Version of gcc:

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
  • 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-06-04T17:42:17+00:00Added an answer on June 4, 2026 at 5:42 pm

    Use Clang, be done with it. Seems like a bug in GCC, cause Clang warns like it should.

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

Sidebar

Related Questions

My goal is to have a program that sleeps in the background but can
I might have a flawed understanding of what shared_examples_for should do, but hear me
Anyone have example Rx code that shows how to execute an action due to
I have an example in C# code, but it is using streamWriter . It
I have an example of some code that I see often in websites that
I have a inefficiently constructed form that is obviously sending one type of data
I have taken this example test before I'll try to take the real one
I have example XML in one of the table column: <Root> <A> <C>c</C> <D>d</D>
Suppose I have written a decorator that does something very generic. For example, it
I have example.xlsx file that contains some data. I want to show the data

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.