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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:45:48+00:00 2026-06-04T08:45:48+00:00

This is an example: #include <stdbool.h> void foo(bool b){}; void bar(bool b) {foo(b);} int

  • 0

This is an example:

#include <stdbool.h>

void foo(bool b){};
void bar(bool b) {foo(b);}

int main() {
    bar(false);
}

I compile with:

gcc -Wtraditional-conversion test.c

I get these warnings:

test.c: In function 'bar':
test.c:4: warning: passing argument 1 of 'foo' with different width due to prototype
test.c: In function 'main':
test.c:7: warning: passing argument 1 of 'bar' with different width due to prototype

Why do these warnings occur? As far as I can see the arguments are all the same type, so should be the same width. What is -Wtraditional-conversion doing to cause these warnings in this very simple piece of code?

I started to get these errors when I switched from using my own typedef of bool to the stdbool.h def.

My original def was:

typedef enum {false, true} bool;
  • 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-04T08:45:50+00:00Added an answer on June 4, 2026 at 8:45 am

    This was a case of not understanding the compiler warning flags.

    Use -Wconversion not -Wtraditional-conversion to get warnings that warn about implicit conversion. -Wtraditional-conversion is for warning about conversions in the absence of a prototype.

    Was caught out because the typdef enum creates a default integer bool type (32bit normally), where as stdbool.h defines bool as an 8bit, which is compatible with the C++ bool.

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

Sidebar

Related Questions

I am using g++ 4.3.0 to compile this example : #include <vector> int main()
I tried to compile this example: #include <stdio.h> #include <stdlib.h> #include <stddef.h> main(){ size_t
Consider this example: #include <iostream> #include <string> #include <vector> #include <iterator> int main() {
I tried this example: /* itoa example */ #include <stdio.h> #include <stdlib.h> int main
Is this example code valid? #include<vector> using namespace std; int main() { vector<int> vec(10);
Consider this example: #include <algorithm> #include <iostream> int main() { std::string str = abcde4fghijk4l5mnopqrs6t8uvwxyz;
I have simplified my problem to this example: #include <GL/glut.h> int main(int argc, char**
Consider this example: #include <iostream> class myclass { public: void print() { std::cout <<
For example: #include <stdio.h> #include <string> int main() { std::string* stuff(NULL); printf(allocating memory...); //line
I have this example code that doesn't compile: #include <iostream> #include <vector> using std::endl;

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.