473,890 Members | 1,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error and warning

Are warnings equally dangerous like errors ????

What is the difference between errors and warnings ??
Jan 14 '08 #1
10 4073
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************ *************** *******@f10g200 0hsf.googlegrou ps.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 "diagnostic s", 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-ScourgeFromRedm ond 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.i nvalid wrote:
....
(Note that this is an implementation detail; the C language only
requires "diagnostic s", 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*********@ver izon.net writes:
dj3va...@csclub .uwaterloo.ca.i nvalid wrote:
...
>(Note that this is an implementation detail; the C language only
requires "diagnostic s", 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_Keit h) <ks***@mib.or g>
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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4146
by: Cary | last post by:
Trying to install on SuSE 8.2 from source. ../configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql --with-unixODBC=/usr/lib getting this error: /root/php-4.3.2/ext/odbc/php_odbc.c -o ext/odbc/php_odbc.lo In file included from /root/php-4.3.2/ext/odbc/php_odbc.c:37: /root/php-4.3.2/ext/odbc/php_odbc_includes.h:118:17: sql.h: No such file or directory
14
1943
by: kosuke | last post by:
I keep getting the following error/warning message when using the python based program getmail4: /usr/lib/python2.3/optparse.py:668: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up return ("<%s at 0x%x: %r>" I'm using python2.3.5 on a debian sid box. The getmail4 website/FAQ maintains that this is a bug in the optparse
1
2719
by: Azzedine | last post by:
Dear All, I compiled a project under Unix, I have got the following errors: ------------------------------------------ CC -I. -DUNIX -c XPCFileStat.C -g -o XPCFileStat.o "XPCFileStat.C", line 11: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*). "XPCFileStat.C", line 20: Warning: String literal converted to char* in formal argument sMsg in call to...
1
4382
by: yanwan | last post by:
Hello I met some problems in linking a project, and hope someone can give me some advice. -----------Configuration: lighting - Win32 Release-------------------- Linking... LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification LIBC.lib(crt0dat.obj) : warning LNK4006: _exit already defined in MSVCRTD.lib(MSVCRTD.dll); second definition ignored LIBC.lib(crt0dat.obj) : warning LNK4006: __exit already defined in
0
1717
by: mmarkzon | last post by:
I have been struggling compiling linkchecker from http://linkchecker.sourceforge.net/. The last thing I get is "error: command 'gcc' failed with exit status 1" which is not very helpful. This is with Python 2.4.1 on Solaris 2.8. Can anyone help? Thank you. -> python setup.py build creating /home/kzvbq3/linkchecker-3.2/_linkchecker_configdata.py running build running build_py
2
5347
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
7
3327
by: i | last post by:
#include<stdio.h> #include<conio.h> #include<process.h> #include<string.h> char ch; int w; int n,m; //void main(); char check(int n,int m,char ch); void cash(int n,int m,char ch);
0
2101
by: bill gates | last post by:
I was trying to use msbee to build an old project. I don't want to upgrade to dotnet2.0. Is there any way to get this to compile using DevStudio 2005 using dotnet1.1. ? Build FAILED. BCCOMStream.cs(11,18): error CS0618: Warning as Error: 'System.Runtime.InteropSe rvices.UCOMIStream' is obsolete: 'Use System.Runtime.InteropServices.ComTypes.IS
39
8290
by: Tsb | last post by:
Now I use FreeBSD 7.0 Current with Gnome. And I use Anjuta IDE to write my C program, and then just do like this. #gcc MYFILE.NAME -o MYFILE.NAME #MYFILE.NAME then it works well. but second time I use like this, there are some errors. Errors are:
1
5741
by: dewi | last post by:
Dear All, I am trying to compile a C code using Visual C++. Can anyone explain how to solve it? Thank You. #include <math.h> #include <string.h> #include "RV2AJFRONT_NEW.h" #include "RV2AJFRONT_NEW_private.h"
0
11227
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10922
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9630
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8016
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5848
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4676
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3276
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.