472,102 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

error and warning

Are warnings equally dangerous like errors ????

What is the difference between errors and warnings ??
Jan 14 '08 #1
10 3940
asit wrote:
Are warnings equally dangerous like errors ????
Sometimes yes, sometimes even more dangerrous, sometimes less. Make sure you
understand what the warning tries to tell you
What is the difference between errors and warnings ??
Usualla errors prevent the compiler to finish it's work, while with warning
that (usually) doesn't happen

Bye, Jojo
Jan 14 '08 #2
On Jan 14, 9:47 am, asit <lipu...@gmail.comwrote:
Are warnings equally dangerous like errors ????

What is the difference between errors and warnings ??
Errors tell you that what you've written is wrong and cant be done

Warnings tell you that what you've written is ambigious, and might not
do what you expect it to do.

Jan 14 '08 #3
In article <0f**********************************@f10g2000hsf. googlegroups.com>,
asit <li*****@gmail.comwrote:
>Are warnings equally dangerous like errors ????
It depends on the warning.
Some of them are harmless. Many of them are more dangerous, since
careless programmers assume they're irrelevant, where errors obviously
need to be fixed.

>What is the difference between errors and warnings ??
If a compiler issues a warning, it probably thinks it can come up with
a sensible way to interpret what you gave it, or suspects that a
well-defined and unambiguous construct is nevertheless probably not
what you intended to say.
An error usually means the compiler is sufficiently confused (or the
code is sufficiently broken) to not be able to continue.

(Note that this is an implementation detail; the C language only
requires "diagnostics", and doesn't distinguish between errors and
warnings.)
dave

--
Dave Vandervies dj3vande at eskimo dot com
I'd suggest that for all your connecting-to-the-ScourgeFromRedmond needs [...]
Perhaps you might consider one of the many fine point-and-click interfaces
offered by your local gunshop? --Anthony de Boer in the scary devil monastery
Jan 14 '08 #4
dj3va...@csclub.uwaterloo.ca.invalid wrote:
....
(Note that this is an implementation detail; the C language only
requires "diagnostics", and doesn't distinguish between errors and
warnings.)
However, I've found that it's commonplace for mandatory diagnostics to
be reported as errors, while other diagnostics tend to be labeled as
warnings.
Jan 14 '08 #5
Joachim Schmitz wrote:
asit wrote:
>Are warnings equally dangerous like errors ????
Sometimes yes, sometimes even more dangerrous, sometimes less. Make
sure you understand what the warning tries to tell you
>What is the difference between errors and warnings ??
Usualla errors prevent the compiler to finish it's work, while with
warning that (usually) doesn't happen
From your other article I gather that you a) use GCC abd b) are pretty new
to C
, so here's an extra hint:
uase gcc's option -Wall -Werror. While -Wall givesa a pretty complete set of
warnings (not all possible ones, but a reasonable subset) -Werror causes
them to be treated as errors (and hence the gcc refuses to compile the
code).
In this group you may also consider using -ansi -pedantic, to get extra
warnings for everything beond the C-Standard.
And as said earlier: only warning you fully understand may get ignored, so
better don't ignore any, but rewrite your code instead.

Bye, Jojo
Jan 14 '08 #6
ja*********@verizon.net writes:
dj3va...@csclub.uwaterloo.ca.invalid wrote:
...
>(Note that this is an implementation detail; the C language only
requires "diagnostics", and doesn't distinguish between errors and
warnings.)

However, I've found that it's commonplace for mandatory diagnostics to
be reported as errors, while other diagnostics tend to be labeled as
warnings.
But that's not universal. For example, gcc often issues mere warnings
for constraint violations, presuambly if the authors thought they
could construct a reasonable interpretation for the code.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jan 14 '08 #7
On Jan 14, 6:47*am, asit <lipu...@gmail.comwrote:
Are warnings equally dangerous like errors ????

What is the difference between errors and warnings ??
Generally, the compiler refuses to emit code with an error and will
still emit code with a warning.

For that reason, warnings are usually more dangerous than errors,
because you can ignore warnings (perhaps unwisely) but you can't
ignore errors.

Finally, something that causes no diagnostic at all is likely to be
the most serious sort of problem. It could be a logic error or
undefined behavior or the programmer casting away an important
warning.
Jan 14 '08 #8
Joachim Schmitz wrote, On 14/01/08 15:18:
Joachim Schmitz wrote:
>asit wrote:
>>Are warnings equally dangerous like errors ????
Sometimes yes, sometimes even more dangerrous, sometimes less. Make
sure you understand what the warning tries to tell you
>>What is the difference between errors and warnings ??
Usualla errors prevent the compiler to finish it's work, while with
warning that (usually) doesn't happen
From your other article I gather that you a) use GCC abd b) are pretty new
to C
, so here's an extra hint:
uase gcc's option -Wall -Werror. While -Wall givesa a pretty complete set of
warnings (not all possible ones, but a reasonable subset) -Werror causes
them to be treated as errors (and hence the gcc refuses to compile the
code).
In this group you may also consider using -ansi -pedantic, to get extra
warnings for everything beond the C-Standard.
I think you meant using -ansi -pedantic to get all the diagnostics
*required* by the C standard. It is -Wall and -Wextra that give you
warnings beyond those required by the C standard.
And as said earlier: only warning you fully understand may get ignored, so
better don't ignore any, but rewrite your code instead.
Please note that you have to understand the warning *before* fixing your
code. For example adding a cast because that looks like what the warning
is suggesting is almost always the wrong thing to do.
--
Flash Gordon
Jan 15 '08 #9
Flash Gordon wrote:
Joachim Schmitz wrote, On 14/01/08 15:18:
>Joachim Schmitz wrote:
>>asit wrote:
Are warnings equally dangerous like errors ????
Sometimes yes, sometimes even more dangerrous, sometimes less. Make
sure you understand what the warning tries to tell you

What is the difference between errors and warnings ??
Usualla errors prevent the compiler to finish it's work, while with
warning that (usually) doesn't happen
From your other article I gather that you a) use GCC abd b) are
pretty new to C
, so here's an extra hint:
uase gcc's option -Wall -Werror. While -Wall givesa a pretty
complete set of warnings (not all possible ones, but a reasonable
subset) -Werror causes them to be treated as errors (and hence the
gcc refuses to compile the code).
In this group you may also consider using -ansi -pedantic, to get
extra warnings for everything beond the C-Standard.

I think you meant using -ansi -pedantic to get all the diagnostics
*required* by the C standard. It is -Wall and -Wextra that give you
warnings beyond those required by the C standard.
Well, I meant warning about things that are non-standard
>And as said earlier: only warning you fully understand may get
ignored, so better don't ignore any, but rewrite your code instead.

Please note that you have to understand the warning *before* fixing
your code. For example adding a cast because that looks like what the
warning is suggesting is almost always the wrong thing to do.
Indeed

bye, Jojo
Jan 15 '08 #10
Joachim Schmitz wrote, On 15/01/08 08:49:
Flash Gordon wrote:
>Joachim Schmitz wrote, On 14/01/08 15:18:
<snip>
>>In this group you may also consider using -ansi -pedantic, to get
extra warnings for everything beond the C-Standard.
I think you meant using -ansi -pedantic to get all the diagnostics
*required* by the C standard. It is -Wall and -Wextra that give you
warnings beyond those required by the C standard.
Well, I meant warning about things that are non-standard
<snip>

OK, I miss-understood what you intended to say. So now I'll address what
you intended...

Adding -ansi -pedantic will, in some senses, not warn about everything
that is non-standard. For example it still will not warn about all
instances of undefined behaviour (-ansi -pedantic -Wall -Wextra comples
closer, but still is not complete) since doing so would be equivalent to
the halting problem.
--
Flash Gordon
Jan 15 '08 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Cary | last post: by
14 posts views Thread by kosuke | last post: by
1 post views Thread by Azzedine | last post: by
1 post views Thread by yanwan | last post: by
reply views Thread by mmarkzon | last post: by
7 posts views Thread by i | last post: by
reply views Thread by bill gates | last post: by
39 posts views Thread by Tsb | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.