This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Named warnings
On 24-Jan-2003, Kai Henningsen <kaih@khms.westfalen.de> wrote:
> And if there *is* a master message list in the docs, I have trouble
> imagining a situation where the lack of self-description in those
> identifiers would be any kind of trouble - if I need to use a number,
> either it's in a compiler message I'm already staring at, or it's in a
> Makefile or source file (and I can look up the message in the docs) ...
The point is that in order to understand the Makefile or source file,
you may often need to look up the message in the docs, rather than the
meaning being just obvious from the name.
For example, what do you think the pragma in the following code does?
This is from win32_threads.c in the Boehm GC:
# ifdef _MSC_VER
# pragma warning(disable:4715)
# endif
ptr_t GC_current_stackbottom()
{
DWORD thread_id = GetCurrentThreadId();
int i;
for (i = 0; i < MAX_THREADS; i++)
if (thread_table[i].stack && thread_table[i].id == thread_id)
return thread_table[i].stack;
ABORT("no thread table entry for current thread");
}
# ifdef _MSC_VER
# pragma warning(default:4715)
# endif
Well, looking at the code it's actually pretty easy to guess this one.
But suppose I change the code so that rather than aborting, it returns
a null pointer value. Should I delete or modify the pragmas?
> Remember, this is the way errno works (except the master list is usually
> in an inconvenient place, like something included by errno.h or the source
> to strerror). People are *used* to this kind of interface.
No, for errno values people use codes like ENOMEDIUM rather than
numbers like 123. ENOMEDIUM is a a lot more mnemonic.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.