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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:59:57+00:00 2026-05-28T03:59:57+00:00

After writing an answer to this question which displays the solution at compile time

  • 0

After writing an answer to this question which displays the solution at compile time with an error, I wondered if it was possible to get a warning instead and finish compilation (as is actually specified in the question).

While diagnostics in general are compiler-dependant, it’s pretty obvious for some code that an error will get triggered (such as accessing a non-existent member or trying to instantiate an object of incomplete type).

The same can’t be said for warnings though, since these tend to differ a great deal between compilers. Even though it’s reasonable to assume that warnings triggered with GCC will also get triggered with Clang, the same can not be said for Visual C++.

Question:
Which warnings, if any, will consistently get triggered on all three mentioned compilers?

/W3 on VC++ and -Wall on GCC & Clang may be assumed.


Note that this is not only useful for that question, but may be useful for triggering a warning for user-defined messages aswell.

  • 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-28T03:59:58+00:00Added an answer on May 28, 2026 at 3:59 am

    This should work on MSVC, GCC, and Clang:

    #pragma message("hello world")
    

    Not very useful, but still works.

    These picked up warnings too:

    • unused variable
    • unused label
    • large values e.g. (1 << 128)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After writing a great big answer to the question Is it bad to work
Suppose, I have a connected socket after writing this code.. if ((sd = accept(socket_d,
I'm writing a tool which will push changes to database after commit to svn.
I often found some URL which looks like the following: www.something.com/some_page/#someword After writing this
Note: this appears to have been fixed in Roslyn This question arose when writing
I'm currently writing an msbuild script to publish a solution, which is all fine
After a pair programming session, an interesting question came up which I think I
Ok so after reading danben's answer on this post , I guess I'm convinced
This has to be a common question that all programmers have from time to
After writing code to populate textboxes from an object, such as: txtFirstName.Text = customer.FirstName;

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.