473,725 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compiler Warnings

I'm new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.

Are the warnings the same no matter what compiler you use, or are they
different for each compiler? I have looked all over the gcc web site, but I
can't find anything that explains what the warnings are.

If someone could take the time to help me out and direct me to some info
about this, I'd appriciate it.

Thanks

Nov 14 '05 #1
20 2724
"News" <ja****@hotmail .com> writes:
I'm new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.
Unlike some compilers' warnings, GCC's are meant to be
self-explanatory. There isn't a place, that I know of, which has
the explanations you are looking for.

If there is a specific warning, or a few, that you would like
explained, c.l.c is a good place to ask. Note that c.l.c is
generally not the right place to ask questions about specific
compilers, but warnings tend to be more about C than about
compilers.
Are the warnings the same no matter what compiler you use, or are they
different for each compiler? I have looked all over the gcc web site, but I
can't find anything that explains what the warnings are.


Every compiler has different warnings.
--
int main(void){char p[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Nov 14 '05 #2
Ben Pfaff wrote:


Every compiler has different warnings.


This is true in two different senses: first, the actual text that is
emitted for a given condition may be different. Second, the choice
whether or not to emit a warning for some condition may be different.

In other words, code that causes one compiler to generate a warning may
cause a different compiler to generate a different warning or no warning
at all.

The standard requires certain conditions to generate a diagnostic, so
some conditions must evoke some form of warning from a
standard-compliant compiler.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Nov 14 '05 #3
Ben Pfaff wrote:
"News" <ja****@hotmail .com> writes:
I'm new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.

Unlike some compilers' warnings, GCC's are meant to be
self-explanatory. There isn't a place, that I know of, which has
the explanations you are looking for.


IBM, at least for the mainframes, and even for other systems, has a
tradition of supplying manuals describing all the messages a given
program could generate. Usually it will describe in more detail than
the printed message the cause, and suggested action to take.

There may be other companies that have a similar system, but it is
not so common. Though I believe that early microsoft compilers
may have done it.

-- glen

Nov 14 '05 #4
glen herrmannsfeldt wrote:

<snip>
IBM, at least for the mainframes, and even for other systems, has a
tradition of supplying manuals describing all the messages a given
program could generate. Usually it will describe in more detail than
the printed message the cause, and suggested action to take.


I have fond (but admittedly vague) memories of these messages:

I40008291 An error has occurred.

Suggested action: Correct the error and re-submit the job.

;-)

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #5
Thank you guys for the info. I remember when I was a kid my father would
have a pocket size book full of warnings he could look at if anything came
up. Like they say, I just have to keep coding and making mistakes, then I
will get less warnings, and also get familiar with what they are. Thanks
again
Nov 14 '05 #6
Jakle wrote:
Thank you guys for the info. I remember when I was a kid my father would
have a pocket size book full of warnings he could look at if anything came
up. Like they say, I just have to keep coding and making mistakes, then I
will get less warnings, and also get familiar with what they are. Thanks
again

Why not train yourself, by making deliberate mistakes and watching what the
compiler does? For example, try leaving a semicolon off a declaration. Or
try using an undefined variable. Or try missing out a necessary header.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #7
Richard Heathfield wrote:

(snip)
Why not train yourself, by making deliberate mistakes and watching what the
compiler does? For example, try leaving a semicolon off a declaration. Or
try using an undefined variable. Or try missing out a necessary header.


I remember a compiler I used to use (not a C compiler) that would
attempt to correct errors. (In the internal representation of the
source program only.) So it had messages like:

Semicolon missing, one inserted in line 123.

In the days of batch programming, it was useful to get as much
out of a compiler run as possible. This would allow the
compiler to get farther through the program, and find more
errors, before giving up.

I don't remember if it could detect unclosed comments, an easy
mistake to make in languages with multiline comments.

-- glen

Nov 14 '05 #8
Richard Heathfield wrote:
glen herrmannsfeldt wrote:

<snip>
IBM, at least for the mainframes, and even for other systems, has a
tradition of supplying manuals describing all the messages a given
program could generate. Usually it will describe in more detail than
the printed message the cause, and suggested action to take.

I have fond (but admittedly vague) memories of these messages:

I40008291 An error has occurred.

Suggested action: Correct the error and re-submit the job.


Yes, some were like that. It does remind me, though, of the time
my program died with a Machine Check error on a system that charged
real money for CPU time, lines printed, etc. It took some
convincing to get credit for a problem that was not my fault.

Machine Check is a hardware error in the processor, that the
processor can detect. Memory parity might be one, though they
usually checked more than that.

-- glen

Nov 14 '05 #9
"News" <ja****@hotmail .com> wrote in message
news:BR******** **********@news 1.news.adelphia .net...
I'm new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.
The content and meanings of compiler warning (and error) messages
are unique to each compiler.

Are the warnings the same no matter what compiler you use,

No.
or are they
different for each compiler?
Yes.
I have looked all over the gcc web site, but I
can't find anything that explains what the warnings are.
I suggest you read more closely :-). I'm sure the gcc manual
has these descriptions.

Also, if you have some code that's producing a warning you don't
understand, you can post it here and others will probably be able
to spot the trouble. But only post enough code to demonstrate the
problem.

If someone could take the time to help me out and direct me to some info
about this, I'd appriciate it.


Any questions about gcc, I'd direct to the gnu web site and/or newsgroups.

-Mike
Nov 14 '05 #10

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

Similar topics

5
11225
by: dis | last post by:
I've been going through my code and clearing away some of the compiler warnings that i'm generating and i've come across areas where i cast pointers to integer values. The Visual Studio compiler generates this warning ... "warning C4311: 'type cast' : pointer truncation from 'void *' to 'DWORD'" The warning is generated as the pointer is apparently 64 bits long (even though a quick sizeof() reports it to only be 4 bytes in length) and...
8
5163
by: Charlie Zender | last post by:
Hi, First, this may be a GCC or Linux-specific problem, I'm not sure. I am unable to compile a large body of code with extremely pedantic compile time checks activate, so that warnings cause errors. With GCC 3.3.1, I do this with gcc -I/usr/local/include -g -O2 -std=c99 -pedantic -pedantic -D_BSD_SOURCE -Wall -Wunused -W -Wmissing-prototypes -Wconversion
43
2724
by: Anitha | last post by:
Hi I observed something while coding the other day: if I declare a character array as char s, and try to use it as any other character array..it works perfectly fine most of the times. It holds strings of any length. I guess what is happening here is that this array initially holds only '\0' and hence is of length 1. But sometimes, when I tried to write some functions and do some
29
2011
by: Daniel Rudy | last post by:
Hello, Consider the following code fragment: fileptr = fopen(param->filename, "r"); if (fileptr == NULL) { error("digest.c: digest_file: Open File ", errno); return(-2); }
2
1719
by: Samuel | last post by:
Imagine you have the following code: try { ... } catch (ThreadAbortException eThread) { if (WorkStopped != null) WorkStopped(this, EventArgs.Empty) }
5
1791
by: rawCoder | last post by:
Hi All, In Visual Basic .NET , your function definition might requirre you to return a value but (accidently/intentionally) you dont put any 'return value' in the function. In this case VB Compiler does not generate any warning. Is there any way to make the compiler generate this and other obvious warnings, is there any switch, or still VB.NET development team assumes that
11
23236
by: Charles Sullivan | last post by:
I have a number of functions, e.g.: int funct1( int arg1, int arg2, int arg3 ); int funct2( int arg1, int arg2, int arg3 ); int funct3( int arg1, int arg2, int arg3 ); that are called via pointers in a table, with the same parameters regardless of the particular function. In some of the functions, one or more of the
3
3190
by: gil | last post by:
Hi, I'm trying to find the best way to work with compiler warnings. I'd like to remove *all* warnings from the code, and playing around with the warning level, I've noticed that compiling with /W3 I get warnings that with /W4 are shown as remarks, e.g.: warning #177: variable "Foo" was declared but never referenced ....is displayed as a "remark #177" with /W4. That doesn't fit the
3
1741
by: Peted | last post by:
Hi Im using vs2008 c# 3.0 and am going through some other person(s) code to clean up compiler warnings that are bieng produced. I have this code (at bottom) where a delegate/event is defined and it builds ok with no errors but im trying to get rid of the
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
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
8096
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...
0
4517
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...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
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

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.