public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: GCC 3.0.2: errno conflict.
@ 2001-12-15 10:56 mike stump
  2001-12-15 10:58 ` Benjamin Kosnik
  0 siblings, 1 reply; 18+ messages in thread
From: mike stump @ 2001-12-15 10:56 UTC (permalink / raw)
  To: aoliva; +Cc: gcc, libstdc++, ncm-nospam

> To: mike stump <mrs@windriver.com>
> From: Alexandre Oliva <aoliva@redhat.com>
> Date: 14 Dec 2001 23:51:30 -0200

> Is this supposed to be read as *any* other headers?

Yes.  For example, older wording said:

2    None of the C headers includes any of the other headers,  except  that
  each  C  header  includes  its  corresponding C++ header, as described
  above.  None of the C++ headers includes any of the C  headers.   How-
  ever, any of the C++ headers can include any of the other C++ headers,
  and must include a C++ header that contains any needed definition.99)

  99) Including any one of the C++ headers can introduce all of the  C++
  headers  into a translation unit, or just the one that is named in the
  #include preprocessing directive.

As you can see, the idea and semantic history can clearly be seen.

> What's the point of defining separate headers and what each one
> should include, then?

Just in case the implementation doesn't offer performance when all
headers are included.  Some C++ systems still do that, like ours.

With a good precompiled header scheme, and because everything is in
std, it seems reasonable to just have all std things visible, all the
time.  The rule was put in at least in part to allow for a single
precompiled header that did the entire std library in one shot with no
subdivision.  In fact, we used to have the header <all>:

4 The header <all> includes all the other C++ headers.

But, for some reason, I can't find it anymore.  Hum, I'll have to go
digging to find out why it didn't last.  It seems like a good idea.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: GCC 3.0.2: errno conflict.
@ 2001-12-14 17:52 mike stump
  2001-12-14 18:27 ` Alexandre Oliva
  0 siblings, 1 reply; 18+ messages in thread
From: mike stump @ 2001-12-14 17:52 UTC (permalink / raw)
  To: aoliva, ncm-nospam; +Cc: gcc, libstdc++

> To: Nathan Myers <ncm-nospam@cantrip.org>
> Cc: libstdc++@gcc.gnu.org, gcc@gcc.gnu.org
> From: Alexandre Oliva <aoliva@redhat.com>
> Date: 14 Dec 2001 22:57:30 -0200

> On Dec 14, 2001, Nathan Myers <ncm-nospam@cantrip.org> wrote:

> > In C++, errno [...] is a reserved name
> > if _any_ standard C++ header is included.  

> Reference?  I couldn't find it in a quick search :-(

This is a homework problem... :-)

  17.3.4.1  Headers                                 [lib.res.on.headers]

1 A C++ header may include other C++ headers.161)                         |

  161) C++ headers must include a C++ header that  contains  any  needed
  definition (3.2).

^ permalink raw reply	[flat|nested] 18+ messages in thread
* GCC 3.0.2: errno conflict.
@ 2001-12-14  7:54 Maxim Dementiev
  2001-12-14 10:17 ` Alexandre Oliva
  2001-12-14 15:53 ` Joe Buck
  0 siblings, 2 replies; 18+ messages in thread
From: Maxim Dementiev @ 2001-12-14  7:54 UTC (permalink / raw)
  To: gcc

Excuse me if this bug is wellknown for peaple.
This code copile with error by g++ 3.0.2 on Linux 2.2.19 (i386).
(See commented line below.)
If rename "errno" to "errno1" - all works fine.
Is it a bug?

======== start ========
namespace mpd
{

class ErrnoException
{
public:
    ErrnoException( const char * const a,
                    const int l,
                    const int r,
                    const int e ) throw() :
        file( a ), line( l ), retval( r ), errno( e ) { }

    const char * const file;
    const int line; 
    const int retval; 
    const int errno;
};

}

#include <iostream>

using ::std::cout;
using ::std::endl;
using ::mpd::ErrnoException;


void func( const int a ) throw( ErrnoException )
{
    if( a == 2 ) throw ErrnoException( __FILE__, __LINE__, 0, 2 );
    return;
}


int main( int n, char ** a )
{
  for( int i=1; i<4; i++ )
    try
    {
        func( i );
        cout << i << endl;
    }
    catch( ErrnoException e )
    {
        cout << "Exception in file " << e.file << " at line #" << e.line <<
                ", errno = " << e.errno << "." << endl; // <-- error!
    }

    return 0;
}
======== end ========


Maxim Dementiev.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-12-16  8:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-15 10:56 GCC 3.0.2: errno conflict mike stump
2001-12-15 10:58 ` Benjamin Kosnik
  -- strict thread matches above, loose matches on Subject: below --
2001-12-14 17:52 mike stump
2001-12-14 18:27 ` Alexandre Oliva
2001-12-14 23:25   ` Nathan Myers
2001-12-14  7:54 Maxim Dementiev
2001-12-14 10:17 ` Alexandre Oliva
2001-12-14 11:34   ` Joe Buck
2001-12-14 12:14     ` Alexandre Oliva
2001-12-14 15:53 ` Joe Buck
2001-12-14 16:59   ` Nathan Myers
2001-12-14 17:08     ` Alexandre Oliva
2001-12-14 17:11       ` Nathan Myers
2001-12-15  5:56   ` Gabriel Dos Reis
2001-12-15 20:38     ` Joe Buck
2001-12-15 23:30       ` Benjamin Kosnik
2001-12-15 23:42       ` Nathan Myers
2001-12-16  1:45       ` Gabriel Dos Reis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).