delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/01/10:03:43

From: Rudolf Polzer <rpolzer AT web DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Internal compiler error - not covered by the FAQ
Date: Wed, 01 Nov 2000 12:20:23 GMT
Organization: Deja.com - Before you buy.
Lines: 74
Message-ID: <8tp1q3$n3r$1@nnrp1.deja.com>
References: <8t3lg2$o6t$1 AT nnrp1 DOT deja DOT com> <39f5dd04 DOT 35951623 AT news DOT freeserve DOT net>
NNTP-Posting-Host: 212.185.252.67
X-Article-Creation-Date: Wed Nov 01 12:20:23 2000 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
X-Http-Proxy: HTTP/1.0 spcss37. (IBM-PROXY-WTE), 1.1 x54.deja.com:80 (Squid/1.1.22) for client 212.185.252.67
X-MyDeja-Info: XMYDJUIDrpolzer
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <39f5dd04 DOT 35951623 AT news DOT freeserve DOT net>,
  dontmailme AT iname DOT com wrote:
> Rudolf Polzer wrote:
>
> > And, as I discovered, DJGPP puts all standard library names into the
> > global namespace,
>
> It's GCC that does that.  However, it also puts them in namespace std,
> (or, at least, acts as if it does) so there's little problem in
practice.

I didnt notice that. But I will change my code so that it puts std::
before everything. BTW, there is another problem:

std::map < ::Sound::Sound > ::iterator i = m.begin()

gives an parse error, while

typedef ::Sound::Sound Snd;
// ...
std::map < Snd > ::iterator i = m.begin()

does not. Why?

>
> > and recompiling in standard-compliant compilers fails.
>
> Only if you were taking advantage of the fact that GCC dumps
everything
> into the global namespace.  (I've seen a number of posts where people
> have done that - there's an awful lot of broken C++ code out there...)

I did not take advantage of it, I looked at some other code and
concluded GCC does not put everything into std, and so I also assumed
everything was global. But after trying to recompile in MSVC++... but
I'll fix it and do not have to keep track of two source trees (I can
just try to compile in MSVC++ and fix all places where the compiler
reports errors).

And there seems to be another problem: When I switch on -Wall, my
programs do not compile any more with messages like this:

In method `M<int>::M(const int &)':
test.cpp(12) Error: instantiated from here
test.cpp(6) Warning:  statement with no effect
There were some errors

Source:
template <class X> class M
{
 public:
 M (const X &x)
 {
  1; // statement with no effect
 }
};

int main()
{
 M<int> (1); // instantiated from here
}

The same program compiles when warnings are switched off. (the error
really occurs in some STL templates that compare int with size_t)

[...] (I dont need it any more)

--
Rudolf Polzer
REBOUNCE - http://www.mycgiserver.com/~rebounce


Sent via Deja.com http://www.deja.com/
Before you buy.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019