help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: errno bug?


From: E. Robert Tisdale
Subject: Re: errno bug?
Date: Wed, 06 Oct 2004 12:39:12 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922

Thomas Maeder wrote:

E. Robert Tisdale writes:


        > cat main.cc
        #include <stdio.h>
        #include <errno.h>

        extern int errno;


This is indeed an errno bug, but in your code :-)

There is no requirement that errno be declared as an int variable by the C++
implementation. I'm not even sure if defining errno as an int variable is
conforming. Usually, it's a macro.

This has nothing to do with standards.
The problem is that /usr/include/bits/errno.h declares:

extern int *__errno_location (void) __THROW __attribute__ ((__const__));

but defines the C preprocessor macro:

#   define errno (*__errno_location ())


The declaration and the macro definition are inconsistent.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]