Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 12221
Product:  
Component:  
Status: RESOLVED
Resolution: INVALID
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Alex Riesen <alexander.riesen@synopsys.com>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 12221 depends on: Show dependency tree
Show dependency graph
Bug 12221 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2003-09-09 09:53
The mentioned line generates compile error:

/u/riesen/gcc-3.4-20030903/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/bits/fstream.tcc:
In member function `virtual streamsize std::basic_filebuf<_CharT,
_Traits>::xsputn(const _CharT*, streamsize)':
/u/riesen/gcc-3.4-20030903/lib/gcc/i686-pc-linux-gnu/3.4/../../../../include/c++/3.4/bits/fstream.tcc:463:
error: expected unqualified-id

For such code:

#include <algorithm>
// some header file doing #define:
#define min(a,b) ((a)<(b)?(a): (b))
#include <fstream>

Probably '#undef min' could be useful in every stl header, as vendors and some
long-living projects seem to never catch up with the idea.

------- Comment #1 From Gabriel Dos Reis 2003-09-09 10:18 -------
Subject: Re:  New: fstream.tcc:463: error: expected unqualified-id

"alexander dot riesen at synopsys dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| For such code:
| 
| #include <algorithm>
| // some header file doing #define:
| #define min(a,b) ((a)<(b)?(a): (b))
| #include <fstream>

This is not a problem in the library.  The code is simply bogus. 
min is a reserved name.  This PR should be resolved invalid.

-- Gaby

------- Comment #2 From Alex Riesen 2003-09-09 10:27 -------
Subject: Re:  fstream.tcc:463: error: expected unqualified-id

gdr at integrable-solutions dot net, Tue, Sep 09, 2003 12:18:32 +0200:
> 
> | For such code:
> | 
> | #include <algorithm>
> | // some header file doing #define:
> | #define min(a,b) ((a)<(b)?(a): (b))
> | #include <fstream>
> 
> This is not a problem in the library.  The code is simply bogus. 
> min is a reserved name.  This PR should be resolved invalid.
> 

I'm not saying the library is wrong.

Of course the code _is_ bogus! The problem is, there is a lot of
such code out there.

If the PR is invalid, why there is "undef min" (and max) in the
stl_algobase.h, line 128?

Can there be any help for a sore programmer confronting the problem next
time? Just a hint to help to identify the place where the macro
redefines a reserved word?

-alex


------- Comment #3 From Gabriel Dos Reis 2003-09-09 10:33 -------
Subject: Re:  fstream.tcc:463: error: expected unqualified-id

"alexander dot riesen at synopsys dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| If the PR is invalid, why there is "undef min" (and max) in the
| stl_algobase.h, line 128?

a carry over from old days, most certainly.  

Probably, should go away.

-- Gaby

------- Comment #4 From Wolfgang Bangerth 2003-09-09 14:10 -------
Just as Gaby said. You can always place the #undef in your own files, in front 
of the #include. It's not the libraries task to clean up macro names. 
 
W. 

------- Comment #5 From Alex Riesen 2003-09-09 14:14 -------
Subject: Re:  fstream.tcc:463: error: expected unqualified-id

bangerth at dealii dot org, Tue, Sep 09, 2003 16:10:58 +0200:
> Just as Gaby said. You can always place the #undef in your own files,
> in front of the #include. It's not the libraries task to clean up
> macro names. 

That's what I did. I'd like to get rid of the offending definition as well,
it's just kind of tricky to find in the maze of headers.


------- Comment #6 From Gabriel Dos Reis 2003-09-09 15:00 -------
Subject: Re:  fstream.tcc:463: error: expected unqualified-id

"alexander dot riesen at synopsys dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| bangerth at dealii dot org, Tue, Sep 09, 2003 16:10:58 +0200:
| > Just as Gaby said. You can always place the #undef in your own files,
| > in front of the #include. It's not the libraries task to clean up
| > macro names. 
| 
| That's what I did. I'd like to get rid of the offending definition as well,

then that is beyond the scope of V3.

-- Gaby

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug