473,796 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compendiums of compiler warning/error messages mapped to actual codeproblems?

Do any of you happen to have links to compendiums (or heaven forbid, an
actual manual) which maps compiler warnings and errors to examples of
actual code problems? In this case I'm specifically looking for one
for gcc. The general problem is of course that the compiler messages
must be short, and that tends to make them so cryptic that it isn't
always immediately obvious what the problem is. It almost makes me long
for the days when the IBM compilers would describe the problem with just
a number - which wasn't useful in and of itself, but was quite helpful
given the umpteen page messages manual which contained excellent
descriptions of each problem, indexed by that number.

Anyway, this comes up (again) because I just figured out that the gcc error:

foo.c:351: error: two or more data types in declaration specifiers

Which was cited for this line (the first prototype):

void handle_message( char *string);

was actually the result of the immediately preceding struct definition:

struct datastructure{
int this;
int that;
/*etc. all valid *
}
^ note the missing semicolon after the closing brace.

In this instance the message was not completely devoid of useful
information, since it at least localized the issue to the vicinity of
line 351, even if the actual error was on the first non blank line
preceding it. The message though - not too helpful. Why not "did not
find expected semicolon"? For this particular message google wasn't
all that helpful - in the first few results it turned up examples of the
message but not an explanation of what caused it.

Regards,

David Mathog
Jan 10 '08 #1
6 2273
On Jan 10, 12:53*pm, David Mathog <mat...@caltech .eduwrote:
Do any of you happen to have links to compendiums (or heaven forbid, an
actual manual) which maps compiler warnings and errors to examples of
actual code problems? *In this case I'm specifically looking for one
for gcc. *The general problem is of course that the compiler messages
must be short, and that tends to make them so cryptic that it isn't
always immediately obvious what the problem is. *It almost makes me long
for the days when the IBM compilers would describe the problem with just
a number - which wasn't useful in and of itself, but was quite helpful
given the umpteen page messages manual which contained excellent
descriptions of each problem, indexed by that number.

Anyway, this comes up (again) because I just figured out that the gcc error:

foo.c:351: error: two or more data types in declaration specifiers

Which was cited for this line (the first prototype):

void *handle_message (char *string);

was actually the result of the immediately preceding struct definition:

struct datastructure{
* *int this;
* *int that;
* */*etc. all valid *}

* ^ note the missing semicolon after the closing brace.

In this instance the message was not completely devoid of useful
information, since it at least localized the issue to the vicinity of
line 351, even if the actual error was on the first non blank line
preceding it. *The message though - not too helpful. Why not "did not
find expected semicolon"? *For this particular message google wasn't
all that helpful - in the first few results it turned up examples of the
message but not an explanation of what caused it.

Regards,

David Mathog
to answer your last question first, and in defense of compiler writers
everywhere:
It is not always possible to determine what is expected as the next
token in the input stream of the compiler. Keep in mind a good
compiler must accept all valid source code AND flag invalid code. The
point at which a compiler detects an error may be, as you know, far
from the actual cause of the problem.

aside from that, I think an errors manual written this way would be
very VERY helpful!
Ed
Jan 10 '08 #2
David Mathog wrote:
Do any of you happen to have links to compendiums (or heaven forbid, an
actual manual) which maps compiler warnings and errors to examples of
actual code problems? In this case I'm specifically looking for one
for gcc. The general problem is of course that the compiler messages
must be short, and that tends to make them so cryptic that it isn't
always immediately obvious what the problem is. It almost makes me long
for the days when the IBM compilers would describe the problem with just
a number - which wasn't useful in and of itself, but was quite helpful
given the umpteen page messages manual which contained excellent
descriptions of each problem, indexed by that number.
Back in Bright College Days, a couple friends managed to
patch the FORTRAN compiler so that the text of every error
message was the single word "WRONG." But they showed mercy by
leaving the message ID intact, so you saw "NA201E - WRONG" and
could at least go to the manual and look up NA201E.
Anyway, this comes up (again) because I just figured out that the gcc
error:

foo.c:351: error: two or more data types in declaration specifiers

Which was cited for this line (the first prototype):

void handle_message( char *string);

was actually the result of the immediately preceding struct definition:

struct datastructure{
int this;
int that;
/*etc. all valid *
}
^ note the missing semicolon after the closing brace.
A couple of FAQ answers come pretty close to diagnosing this
problem, although none seems to get exactly this manifestation.
In this instance the message was not completely devoid of useful
information, since it at least localized the issue to the vicinity of
line 351, even if the actual error was on the first non blank line
preceding it. The message though - not too helpful. Why not "did not
find expected semicolon"? For this particular message google wasn't
all that helpful - in the first few results it turned up examples of the
message but not an explanation of what caused it.
It's perhaps a bit too much to ask that the compiler diagnose
the problem as "missing semicolon," since inserting a semicolon
is not the only transformation that would make the source valid.
For example, "extraneous `void'" is equally plausible, since
removing `void' would produce a valid declaration. In general,
a given invalid source may be "near" in an edit-distance sense
to several different valid sources, so describing the error in
terms of "the" correction that would fix it amounts to choosing
between those valid alternatives -- which amounts to reading the
programmer's mind.

I take some pleasure in the activity of pondering a c.l.c.
question and trying to answer it in the questioner's terms. This
involves looking behind the question itself and trying to imagine
what confusion or misconception led the questioner to ask it, and
then to come up with an explanation that addresses the underlying
problem. Thus, "You forgot to allocate space for the string's
terminating zero" instead of "Add one to the malloc() argument;"
the latter answers the "How do I fix it?" question, but the
former is more helpful. I think our computers will continue to
emit messages of the latter kind for the foreseeable future,
and that messages of the "sympatheti c analysis" kind will remain
the province of humans who learned the hard way.

--
Er*********@sun .com
Jan 10 '08 #3
David Mathog wrote:
Do any of you happen to have links to compendiums (or heaven forbid, an
actual manual) which maps compiler warnings and errors to examples of
actual code problems? In this case I'm specifically looking for one
for gcc. The general problem is of course that the compiler messages
must be short, and that tends to make them so cryptic that it isn't
always immediately obvious what the problem is. It almost makes me long
for the days when the IBM compilers would describe the problem with just
a number - which wasn't useful in and of itself, but was quite helpful
given the umpteen page messages manual which contained excellent
descriptions of each problem, indexed by that number.

Anyway, this comes up (again) because I just figured out that the gcc
error:

foo.c:351: error: two or more data types in declaration specifiers

Which was cited for this line (the first prototype):

void handle_message( char *string);

was actually the result of the immediately preceding struct definition:

struct datastructure{
int this;
int that;
/*etc. all valid *
}
^ note the missing semicolon after the closing brace.

In this instance the message was not completely devoid of useful
information, since it at least localized the issue to the vicinity of
line 351, even if the actual error was on the first non blank line
preceding it. The message though - not too helpful. Why not "did not
find expected semicolon"? For this particular message google wasn't
all that helpful - in the first few results it turned up examples of the
message but not an explanation of what caused it.

Regards,

David Mathog

This is a quality of implementation issue...

For instance this program
struct datastructure{
int this;
int that;
}

int main(void)
{
}

provokes with lcc-win:
Error twarn.c: 6 missing semicolon after structure declaration
Warning twarn.c: 6 multiple use of 'int'
1 error, 1 warning

Better isn't it?

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jan 10 '08 #4
jacob navia <ja***@nospam.c omwrites:
For instance this program
struct datastructure{
int this;
int that;
}

int main(void)
{
}

provokes with lcc-win:
Error twarn.c: 6 missing semicolon after structure declaration
Warning twarn.c: 6 multiple use of 'int'
The warning here does not make any sense: `int' is only used once
in this declaration (except inside the struct definition--but
that's clearly not what the warning talks about).
--
char a[]="\n .CJacehknorstu" ;int putchar(int);in t main(void){unsi gned long b[]
={0x67dffdff,0x 9aa9aa6a,0xa77f fda9,0x7da6aa6a ,0xa67f6aaa,0xa a9aa9f6,0x11f6} ,*p
=b,i=24;for(;p+ =!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)bre ak;else default:continu e;if(0)case 1:putchar(a[i&15]);break;}}}
Jan 11 '08 #5
jacob navia wrote:
This is a quality of implementation issue...

For instance this program
struct datastructure{
int this;
int that;
}

int main(void)
{
}

provokes with lcc-win:
Error twarn.c: 6 missing semicolon after structure declaration
Warning twarn.c: 6 multiple use of 'int'
1 error, 1 warning

Better isn't it?
Actually, it's an abomination. "Multiple use of 'int'" has no
relationship to the problem with this code. It is wrong and completely
unhelpful.

The gcc diagnostics for this code are much more to the point:

a.c:6: error: two or more data types in declaration specifiers
a.c:7: warning: return type of 'main' is not 'int'

There are numerous nice features of lcc-win. This bogus diagnostic is
not one of them.
Jan 11 '08 #6
In article <f4************ *************** *******@v4g2000 hsf.googlegroup s.com>,
Ed Prochak <ed*******@gmai l.comwrote:
>It is not always possible to determine what is expected as the next
token in the input stream of the compiler. Keep in mind a good
compiler must accept all valid source code AND flag invalid code. The
point at which a compiler detects an error may be, as you know, far
from the actual cause of the problem.
Long ago I used an compiler in which almost every error message was
followed by the suggestion "missing semicolon?". It was often right.

-- Richard
--
:wq
Jan 11 '08 #7

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

Similar topics

15
1377
by: M P | last post by:
What does this mean? I am accessing an ASP page that queries Access Database thru fileDSN. I'm using IIS 5.0 Win2K SP4 Microsoft OLE DB Provider for ODBC Drivers error '80004005' General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x444 Thread 0xfe4 DBC 0x5200024 Jet'.
5
1105
by: Patrick Coleman | last post by:
Hi, This may seem to be a basic question, but I keep getting the following error: main.cc:93: undefined reference to `AT_UrlParser::AT_UrlParser(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)' line 93: AT_UrlParser qservice(service); I'm including a custom header file that defines AT_UrlParser.
6
8626
by: paul calvert | last post by:
I hope somewhere here has encountered and solved a similar problem in the past. 1) on a new Win2000 PC: installed Visual C++ 6.0 download & install single file Service Pack 5.0 2) try to build my gui and dll projects, whose project, workspace, source files all resided on network drive mapped to H. The H mapping,
10
2309
by: forgotten field | last post by:
Hi,how are you? I have been studying C++ by myself, but recently I am having a real problem. I am learning about the basic usage of a doubly linked list using polymorphism. However, I have got the compiler errors which I just can't understand what they mean. I searched the webs for any clues on how to solve the problems. But I've never been able to find one. Now I am wondering if there is any website which tells people how to understand...
19
3558
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours to find the _current_ reporting page... #include <vector> #include <iostream>
7
2677
by: Matthew Del Buono | last post by:
Don't try to solve the problem. I've found a way -- around or fixing it. I'm just curious as to whether this is Microsoft's problem in their compiler or if there's a standard saying this is to be true (not necessarily an internal compiler error, but still an error) This may just a bit OT, but I decided to post it here instead of Microsoft because my question is more directed towards standards... Of course, any other day I would have...
13
1346
by: junky_fellow | last post by:
N869, Page 47, "Except when it is the operand of the sizeof operator or the unary & operator, or is a string literal used to initialize an array, an expression that has type ''array of type'' is converted to an expression with type ''pointer to type'' that points to the initial element of the array object and is not an lvalue." Now, consider following piece of code,
45
2284
by: alertjean | last post by:
Or may be I am stubborn or dumb ... of not putting in a * in the typecast. This is code I am worrying about long long b=1; int *address ; address=(int)&b; printf ("%x %x \n",*(address+1)*address); when I compile the code I get this warning from gcc (although it
18
2963
by: andreas.luethi | last post by:
Hi All Compile a our source with BM XL C/C++ Enterprise Edition V8.0 for AIX (Version: 08.00.0000.0000) produces a lot of Informational message like this: "aaalib.c", line 671.1: 1506-412 (I) Referenced variable "n", which was not initialized in its declaration. n is a variable in procedure an is assigned before used. Compiling the
0
9525
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
10221
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
10169
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
10003
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
6785
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
5440
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
4115
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
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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.