467,166 Members | 1,038 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,166 developers. It's quick & easy.

what is the difference between a compiler error & a warning

in c program what is the difference between a compiler error and a warning
Jun 8 '13 #1
  • viewed: 13437
3 Replies
Expert Mod 8TB
A compiler error means your code has a syntax error that causes the compiler to give up. No program is generated. You must fix the error.

A compiler warning means the compiler suspects your program might crash or behave strangely but the syntax is correct. The warning suggests you rework the code to make the warning go away.

BTW it is common practice in software companies to have the compiler flag all warnings as errors before the software is released. Well written programs have no errors and no warnings when they compile and link.
Jun 8 '13 #2
A compile error happens when the compiler reports something wrong with your program, and does not produce a machine-language translation. You will get compile errors. Everybody does. Don't let them bother you. They are usually relatively easy to fix.

If you request warnings, the compiler will also warn you when it sees something that does not look right. A program that only has warnings will be translated to machine language, but you should be suspicious of it. Pay attention to the warnings.
4 Weeks Ago #3
Expert 256MB
The difference is that the error cannot be corrected. A warning is just a reminder of a possible error.
The errors can be corrected. Not by the machine because it doesn't have its own decision-making ability and doesn't know what the programmer intends to do. But by the programmer. In fact, the purpose of displaying the errors is to let the programmer know of the issues so that suitable corrections and manipulations can be applied to the code accordingly to make it work the way the programmer wants it to. Code can be compiled in the presence of warnings doesn't imply anything like 'warnings can be/are corrected'.
4 Weeks Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

19 posts views Thread by Alf P. Steinbach | last post: by
7 posts views Thread by Matthew Del Buono | last post: by
5 posts views Thread by rawCoder | last post: by
1 post views Thread by keithb | last post: by
4 posts views Thread by wenmang@yahoo.com | last post: by
reply views Thread by erik.erikson@gmail.com | last post: by
10 posts views Thread by asit | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.