gcc patch file for g++ templates

gcc patch file for g++ templates

Post by Lynn Che » Mon, 26 Feb 1996 04:00:00



Hi, there,

I tried to update my gcc with supporting of tempates, with
gcc-2.7.2-repo, but i don't know where should i patch it(first
time doing patch stuff). I could not find useful docs tell
you detail of that. Could any body can help me on that?

Follwong are the message i got from patch command(it shows the same
message when i did "patch -p0 < gcc-2.7.2-repo"

.............................................................
bash# patch < gcc-2.7.2-repo
Hmm...  Looks like a new-style context diff to me...
The text leading up to this was:
--------------------------
|diff -cN /tege/gcc/gcc-2.7.2/Makefile.in ./Makefile.in
|*** /tege/gcc/gcc-2.7.2/Makefile.in    Sun Nov 26 11:44:25 1995
|--- ./Makefile.in      Mon Dec  4 19:45:06 1995
--------------------------
File to patch:
...............................................................


 
 
 

1. gcc 2.96 vs. gcc 3.2: namespace, template incompatability

The old code I once wrote in redhat 7.3(gcc 2.96) are no longer
compiled without errors in gcc 3.2 after I upgrade to redhat 8.0.

In gcc 3.2, the compiler always complain that 'cin', 'endl' etc. are
undefined unless I add the line "using namespace std".

In addition, there is also some problem in template, for example, the
code segment below is compiled OK in gcc 2.96, but there are a lot of
errors given by gcc 3.2. And there is still a error after I add "using
namespace std"

$ g++ -o max_string max_string.C
max_string.C: In function `int main()':
max_string.C:37: cannot convert
`__gnu_cxx::__normal_iterator<std::string*,
   std::vector<std::string, std::allocator<std::string> > >' to
`std::string*'
   in initialization
$

// code segment in "C++ Primer" chapter 20 iostream library
#include <string>
#include <algorithm>
#include <iterator>
#include <vector>
#include <iostream>

using namespace std;

bool length_less( string s1, string s2 )
    { return s1.size() < s2.size(); }

template <class InputIterator>
void filter_string( InputIterator first, InputIterator last,
                    string filt_elems = string( "\",?." ))
{
    for (; first != last; first++) {
        string::size_type pos = 0;
        while ( (pos = (*first).find_first_of(filt_elems, pos))
                != string::npos )
            (*first).erase( pos, 1 );
    }

int main()
{
    istream_iterator<string> input( cin ), eos;

    vector<string> text;
    // copy is a generic algorithm
    // copy from standard input to text
    copy( input, eos, back_inserter( text ));
    string filt_elems( "\",.?;:" );
    filter_string( text.begin(), text.end(), filt_elems );

    int cnt = text.size();
    // max_element is a generic algorithm
    string *max = max_element( text.begin(), text.end(), length_less
);
    int len = max->size();

    cout << "The number of words read is " << cnt << endl;
    cout << "The longest word has a length of " << len << endl;
    cout << "The longest word is " << *max << endl;

2. Problems with USB Lexar Jumpdrive

3. Help can't compile InterViews with gcc patches and Linux patches

4. help needed on SCSI HD partitioning for linux

5. Patch for kernel with new gcc (was Re: GCC-2.7.1...)

6. Whats the current "Fair" wage in the USA?

7. using template template parameters

8. KernSecurityLevel

9. gcc 2.7.2 , Templates & Exceptions

10. gcc (g++) and Templates... Help!

11. Templates and large symbols under Solaris and GCC 2.8.0

12. newbie to gcc/g++ on Linux needs basic template help

13. Problems compiling a simple program using templates with GCC