From: Ralf T. <ra...@gm...> - 2002-06-10 08:22:26
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of dev...@li... > Sent: Samstag, 8. Juni 2002 05:23 > To: dev...@li... > Subject: Dev-cpp-users digest, Vol 1 #807 - 6 msgs > > > Send Dev-cpp-users mailing list submissions to > dev...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > or, via email, send a message with subject or body 'help' to > dev...@li... > > You can reach the person managing the list at > dev...@li... > > When replying, please edit your Subject line so it is more > specific than "Re: Contents of Dev-cpp-users digest..." > > > Today's Topics: > > 1. MINGW GCC 3.1 for Windows is out there (Ioannis Vranos) > 2. MINGW GCC 3.x II (Ioannis Vranos) > 3. merging two sorted lists using file streams... (chromatonus 712) > 4. RE: #include <ios> (Ioannis Vranos) > 5. RE: #include <ios> (Ioannis Vranos) > 6. Re: merging two sorted lists using file streams... > (Jason Hardman) > > --__--__-- > > Message: 1 > From: "Ioannis Vranos" <no...@ho...> > To: "Dev-C++ Mailing List" <dev...@li...> > Date: Sat, 8 Jun 2002 01:13:03 +0300 > Subject: [Dev-C++] MINGW GCC 3.1 for Windows is out there > > This is a multi-part message in MIME format. > > ------=_NextPart_000_0001_01C20E89.A3D41990 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > I decided to take a look at MINGW site and saw that there are > recent distributions of many components of MINGW including a > GCC 3.1 release! But there is not yet a newest "official" > distribution of MINGW yet (there is still the classic 1.1 of > 2001 release). However i have the feeling that one is about > to come soon (but "soon" can be even months). > > > Anyway for all coders out there who can handle this kind of > things, can download the latest GCC 3.1 core distribution and > the latest MINGW run time, and uncompress them above their > current MINGW distribution. > > > As expected the latest GCC is far more compliant than the 2.x > series so the code below compiles happily: > > > #include <vector> > #include <iostream> > #include <stdexcept> > > int main() try > { > using namespace std; > > vector<int>array(50); > > for(unsigned i=0; i<100; i++) > cout<<(array.at(i)=i)<<" "; > > } > > catch(std::out_of_range) > { > std::cout<<"\n\nBe careful dude! What are you doing dude?\n"; } > > > But before you decide to do the hack update, be careful that > you must know what you are doing. If you do not know how to > do this kind of things then wait for the official MINGW > distribution when it becomes available, or the Dev-C++ > version that will include it. > > > What i have done (not tested with Dev-C++): > > 1) I downloaded the files > > http://telia.dl.sourceforge.net/sourceforge/mingw/gcc-3_1-core > -20020516- > 1.tar.gz > (about 600k) > > > http://telia.dl.sourceforge.net/sourceforge/mingw/mingw-runtim > e-2.0-2002 > 0430.tar.gz > (about 10 MB) > > > 2) I uncompressed the first on a temporary empty folder and > then cut & paste above my old MINGW distribution. > > Then i uncompressed the second on the temporary empty folder > and then cut & paste above my old MINGW distribution. > > > 3) Everything works happily: > > C:\>g++ -v > Reading specs from c:/mingw/bin/../lib/gcc-lib/mingw32/3.1/specs > Configured with: ../gcc/configure --with-gcc --with-gnu-ld > --with-gnu-as --host= mingw32 --target=mingw32 > --prefix=/mingw --enable-threads --disable-nls --enable > -languages=f77,c++,objc,ada --disable-win32-registry > --disable-shared Thread model: win32 gcc version 3.1 > > C:\>gcc -v > Reading specs from c:/mingw/bin/../lib/gcc-lib/mingw32/3.1/specs > Configured with: ../gcc/configure --with-gcc --with-gnu-ld > --with-gnu-as --host= mingw32 --target=mingw32 > --prefix=/mingw --enable-threads --disable-nls --enable > -languages=f77,c++,objc,ada --disable-win32-registry > --disable-shared Thread model: win32 gcc version 3.1 > > > C:\c>g++ temp.cpp -o temp -ansi -pedantic-errors -Wall > -fexpensive-optimizations -O3 -ffloat-store -mcpu=pentiumpro > > C:\c>temp > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 > 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 > 44 45 46 47 48 49 > > Be careful dude! What are you doing dude? > > C:\c> > > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > <http://www.noicys.cjb.net/> > * Alternative URL: http://run.to/noicys > > ------=_NextPart_000_0001_01C20E89.A3D41990 > Content-Type: text/html; > charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 > Transitional//EN"> <HTML><HEAD> <META > HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = > charset=3Dus-ascii"> <TITLE>Message</TITLE> > > <META content=3D"MSHTML 6.00.2716.2200" > name=3DGENERATOR></HEAD> <BODY> <DIV><STRONG><FONT > face=3DArial color=3D#000080 size=3D2><SPAN=20 > class=3D163515821-07062002>I decided to take a look at MINGW > site and = saw that=20 there are recent distributions > of many components of MINGW = including a GCC=20 3.1 > release! But there is not yet a newest "official" > distribution = of MINGW=20 yet (there is still the classic > 1.1 of 2001 release). However = i have=20 the > feeling that one is about to come soon (but "soon" can be > even=20 months).</SPAN></FONT></STRONG></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002>Anyway for all > coders out there who can = handle this=20 kind of things, can > download the latest GCC 3.1 core distribution and = the > latest=20 MINGW run time, and uncompress them above their > current MINGW = distribution.=20 > </SPAN></FONT></STRONG></DIV> <DIV><STRONG><FONT face=3DArial > color=3D#000080 size=3D2><SPAN=20 > class=3D163515821-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002>As expected the > latest GCC is far more = compliant than=20 the 2.x series so > the code below compiles = happily:</SPAN></FONT></STRONG></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002>#include > <vector><BR>#include=20 <iostream><BR>#include = > <stdexcept></SPAN></FONT></STRONG></DIV> > <DIV> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002>int main() > try<BR>{<BR> using namespace = > > std;</SPAN></FONT></STRONG></DIV> > <DIV> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002> =20 > vector<int>array(50);</SPAN></FONT></STRONG></DIV> > <DIV> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002> > for(unsigned i=3D0; i<100;=20 > i++)<BR> > i++cout<<(array.at(i)=3Di)<<"=20 > ";</SPAN></FONT></STRONG></DIV> > <DIV> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002>}</SPAN></FONT></STRONG></DIV> > <DIV> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D163515821-07062002>catch(std::out_of_range)<BR>{<BR> =20 > std::cout<<"\n\nBe careful dude! What are you doing=20 > dude?\n";<BR>}</SPAN></FONT></STRONG></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV><SPAN class=3D163515821-07062002><FONT face=3DArial > color=3D#000080 = > > size=3D2><STRONG>But before you decide to do the hack update, > be careful = that you=20 must know what you are doing. If you > do not know how to do this kind of = things=20 then wait for > the official MINGW distribution when it becomes available, = or the=20 > Dev-C++ version that will include it.</STRONG></FONT></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2>What i have done > (not tested with = > Dev-C++):</FONT></STRONG></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2>1) I downloaded the files</FONT></STRONG></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2><A=20 > href=3D"http://telia.dl.sourceforge.net/sourceforge/mingw/gcc- > 3_1-core-20= > 020516-1.tar.gz">http://telia.dl.sourceforge.net/sourceforge/m > ingw/gcc-3_= > 1-core-20020516-1.tar.gz</A></FONT></STRONG></SPAN></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 class=3D163515821-07062002>(about > 600k)</SPAN></FONT></STRONG></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2><A=20 > href=3D"http://telia.dl.sourceforge.net/sourceforge/mingw/ming > w-runtime-2= > .0-20020430.tar.gz">http://telia.dl.sourceforge.net/sourceforg > e/mingw/min= > gw-runtime-2.0-20020430.tar.gz</A></FONT></STRONG></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2>(about 10 > MB)</FONT></STRONG></SPAN></DIV> <DIV><SPAN > class=3D163515821-07062002><STRONG><FONT face=3DArial = > color=3D#000080=20 size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2>2) I uncompressed the first on a temporary empty > folder and = then cut=20 & paste above my old MINGW = > distribution.</FONT></STRONG></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2>Then i > uncompressed the second on the temporary empty = folder > and=20 then cut & paste above my old MINGW=20 > distribution.</FONT></STRONG></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2>3) Everything works happily:</FONT></STRONG></SPAN></DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2>C:\>g++ > -v<BR>Reading specs from=20 > c:/mingw/bin/../lib/gcc-lib/mingw32/3.1/specs<BR>Configured > with:=20 ../gcc/configure --with-gcc --with-gnu-ld > --with-gnu-as = --host=3D<BR>mingw32=20 --target=3Dmingw32 > --prefix=3D/mingw --enable-threads --disable-nls=20 > --enable<BR>-languages=3Df77,c++,objc,ada > --disable-win32-registry=20 --disable-shared<BR>Thread model: > win32<BR>gcc version=20 3.1</FONT></STRONG></SPAN></DIV> > <DIV> </DIV> <DIV><SPAN > class=3D163515821-07062002><STRONG><FONT face=3DArial = > color=3D#000080=20 size=3D2>C:\>gcc -v<BR>Reading specs > from=20 > c:/mingw/bin/../lib/gcc-lib/mingw32/3.1/specs<BR>Configured > with:=20 ../gcc/configure --with-gcc --with-gnu-ld > --with-gnu-as = --host=3D<BR>mingw32=20 --target=3Dmingw32 > --prefix=3D/mingw --enable-threads --disable-nls=20 > --enable<BR>-languages=3Df77,c++,objc,ada > --disable-win32-registry=20 --disable-shared<BR>Thread model: > win32<BR>gcc version=20 3.1</FONT></STRONG></SPAN></DIV> > <DIV> </DIV> <DIV><SPAN > class=3D163515821-07062002><STRONG><FONT face=3DArial = > color=3D#000080=20 size=3D2></FONT></STRONG></SPAN> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2>C:\c>g++ > temp.cpp -o temp -ansi -pedantic-errors -Wall=20 > -fexpensive-optimizations<BR> -O3 -ffloat-store=20 > -mcpu=3Dpentiumpro</FONT></STRONG></SPAN></DIV> > <DIV> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 size=3D2>C:\c>temp<BR>0 > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 = 19 20 21=20 22 > 23 24 25 26 27 28 29<BR>30 31 32 33 34 35 36 37 38 39 40 41 > 42 43 44 = 45 46 47=20 48 49</FONT></STRONG></SPAN></DIV> > <DIV> </DIV> <DIV><SPAN > class=3D163515821-07062002><STRONG><FONT face=3DArial = > color=3D#000080=20 size=3D2>Be careful dude! What are you > doing = dude?</FONT></STRONG></SPAN></DIV> > <DIV> </DIV> > <DIV><SPAN class=3D163515821-07062002><STRONG><FONT > face=3DArial = color=3D#000080=20 > size=3D2>C:\c></FONT></STRONG></SPAN></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 = > size=3D2></FONT></STRONG> </DIV> > <DIV> </DIV> > <DIV align=3Dleft> > <DIV align=3Dleft><FONT face=3DArial color=3D#000080 = > size=3D2><STRONG>Ioannis<BR><BR>*=20 > Ioannis Vranos<BR>* Programming pages: <A=20 > href=3D"http://www.noicys.cjb.net/">http://www.noicys.cjb.net< > /A></STRONG= > ></FONT></DIV> > <DIV align=3Dleft><FONT face=3DArial color=3D#000080 > size=3D2><STRONG>* = Alternative URL:=20 <A=20 > href=3D"http://run.to/noicys">http://run.to/noicys</A></STRONG > ></FONT></D= > IV></DIV></BODY></HTML> > > ------=_NextPart_000_0001_01C20E89.A3D41990-- > > > --__--__-- > > Message: 2 > From: "Ioannis Vranos" <no...@ho...> > To: "Dev-C++ Mailing List" <dev...@li...> > Date: Sat, 8 Jun 2002 01:30:20 +0300 > Subject: [Dev-C++] MINGW GCC 3.x II > > This is a multi-part message in MIME format. > > ------=_NextPart_000_0001_01C20E8C.0D6A8450 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > And the release notes for the MINGW GCC 3.1: > http://sourceforge.net/project/shownotes.php?release_id=90000 > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > <http://www.noicys.cjb.net/> > * Alternative URL: http://run.to/noicys > > > ------=_NextPart_000_0001_01C20E8C.0D6A8450 > Content-Type: text/html; > charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 > Transitional//EN"> <HTML><HEAD> <META > HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = > charset=3Dus-ascii"> <TITLE>Message</TITLE> > > <META content=3D"MSHTML 6.00.2716.2200" > name=3DGENERATOR></HEAD> <BODY> <DIV><STRONG><FONT > face=3DArial color=3D#000080 size=3D2><SPAN=20 > class=3D171472922-07062002>And the release notes for the > MINGW GCC 3.1: = <A=20 > href=3D"http://sourceforge.net/project/shownotes.php?release_i > d=3D90000">= > http://sourceforge.net/project/shownotes.php?release_id=3D9000 > 0</A></SPAN= > ></FONT></STRONG></DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D171472922-07062002></SPAN></FONT></STRONG> </DIV> > <DIV><STRONG><FONT face=3DArial color=3D#000080 > size=3D2><SPAN=20 > class=3D171472922-07062002></SPAN></FONT></STRONG> </DIV> > <DIV> </DIV> > <DIV align=3Dleft> > <DIV align=3Dleft><FONT face=3DArial color=3D#000080 = > size=3D2><STRONG>Ioannis<BR><BR>*=20 > Ioannis Vranos<BR>* Programming pages: <A=20 > href=3D"http://www.noicys.cjb.net/">http://www.noicys.cjb.net< > /A></STRONG= > ></FONT></DIV> > <DIV align=3Dleft><FONT face=3DArial color=3D#000080 > size=3D2><STRONG>* = Alternative URL:=20 <A=20 > href=3D"http://run.to/noicys">http://run.to/noicys</A></STRONG > ></FONT></D= > IV></DIV> > <DIV> </DIV></BODY></HTML> > > ------=_NextPart_000_0001_01C20E8C.0D6A8450-- > > > --__--__-- > > Message: 3 > From: "chromatonus 712" <chr...@ho...> > To: dev...@li... > Date: Sat, 08 Jun 2002 00:48:36 +0000 > Subject: [Dev-C++] merging two sorted lists using file streams... > > Hi, here is my program that is suppose to read one piece of > data from 2 > different sorted lists each, > > like these two text files: > > File A: > 1 > 2 > 4 > 8 > 16 > File B: > 0 > 1 > 1 > 2 > 3 > 5 > 8 > > output should be > File C: > 0 1 1 1 2 2 3 4 5 8 8 16 > > Would anyone give a sample program that performs this > function, using only > the "basic" file stream operations as in my program below? > Thank you very > much > > #include "apstring.h" > #include <iostream.h> > #include <fstream.h> > #include <conio.h> > > int main() > { > ifstream a; ifstream b; > ofstream c; > a.open("A.dat"); > b.open("B.dat"); > int ark, bum, j, k, temp; > a >> ark; > a.ignore(80,'\n'); > j = ark; > b >> bum; > b.ignore(80,'\n'); > k = bum; > if( ark < bum ) > { > c << ark << endl; > a >> ark; > a.ignore(80,'\n'); > temp = ark; > } > else > { > c << bum << endl; > b >> bum; > b.ignore(80,'\n'); > temp = bum; > } > if(j<k) > { > while( b>>bum && bum<temp ) > { > b >> bum; > b.ignore(80,'\n'); > c << bum << endl; > b >> bum; > b.ignore(80,'\n'); > } > c << temp << endl; > temp = bum; > } > else > { > while( a>>ark && ark<temp ) > { > a >> ark; > a.ignore(80,'\n'); > c << ark << endl; > a >> ark; > a.ignore(80,'\n'); > } > c << temp << endl; > temp = ark; > } > while( c << temp ) > { > cout << temp << endl; > } > system("PAUSE"); > a.close(); > b.close(); > c.close(); > > > return 0; > } > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > > --__--__-- > > Message: 4 > From: "Ioannis Vranos" <no...@ho...> > To: "Dev-C++ Mailing List" <dev...@li...> > Subject: RE: [Dev-C++] #include <ios> > Date: Sat, 8 Jun 2002 05:29:34 +0300 > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Bob Wilson > > Sent: Thursday, June 06, 2002 3:33 AM > > To: Dev-C++ User Mailing List > > Subject: Re: [Dev-C++] #include <ios> > > > > > **IMPORTANT NOTE FOR NEW C++ PROGRAMMERS ** > > > Also, there is no such thing as an "ANSI C++ compliant > > compiler" -- *all* > > > current compilers fail the conformance tests in various > > ways. This means > > > that sample code inevitably needs to be modified for > > different compilers. > > > > For the simplist programs, however, there should not be any > > modifications > > required. Just out of curiosity, do you know of a "knowledge > > base" that > > summarizes the changes that are often reuired from compiler > > to compiler? > > > Not for the simplest only. There is no need for such a knowledge base, > because ANSI C++ conformance will be improving continually. > Do not think > that there will remain gray areas at the end, as for ANSI SQL > conformance for example. There are already compilers with 100% > conformance. > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > * Alternative URL: http://run.to/noicys > > > --__--__-- > > Message: 5 > From: "Ioannis Vranos" <no...@ho...> > To: "Dev-C++ Mailing List" <dev...@li...> > Subject: RE: [Dev-C++] #include <ios> > Date: Sat, 8 Jun 2002 05:45:05 +0300 > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Mac Reiter > > Sent: Thursday, June 06, 2002 12:00 AM > > To: Dev-C++ User Mailing List > > Subject: Re: [Dev-C++] #include <ios> > > > > > > Daniel: > > > > The <ios> header is generally not needed, and should have > > been included by > > other iostreams headers. I suspect that the GCC or MinGW > > people simply > > removed the standalone header, or perhaps it is present but > > can only be > > found if you specify <ios.h> instead of just <ios>. (The <ios.h> is > > *purely* a guess and I haven't run any checks at all). Since > > Dev-C++ is > > "just" the editor/debugger/project manager, and it uses the > GCC/MinGW > > toolchain for actual compilation, these kinds of issues will depend > > entirely on how the GCC/MinGW tools work. > > > > <ios> is needed when you want to use the facilities icnluded > in it. You > can not depend if a header file is included in another when > not defined > by the standard (if you wat the code to be portable, not even among > different compilers and platforms, but even to the next > version of your > favorite compiler). > > You *must not* care about implementation details inside your code, and > certainly not connect your code with them. It is the > compiler's job for > what headers it #include s inside other header files. > > > > Microsoft's take on <ios> is given in the following MSDN article: > > > > http://msdn.microsoft.com/library/default.asp?url=/library/en- > > us/vcstdlib/ht > > ml/vclrfios_header.asp > > > > Basically, you could simply remove the <ios> line entirely, and both > > compilers would be happy and you wouldn't need the > > preprocessor commands > > ("ifndef", etc). I'm gonna guess that the book was written > > some time ago, > > some of the C++ standards changed along the way, and not all > > of the sample > > code got updated. > > > No the book is ANSI C++ compliant (at least as far as i know, and C++ > god approves it, and god only approves excellent ANSI C++ compliant > books). > > > > > > > **IMPORTANT NOTE FOR NEW C++ PROGRAMMERS ** > > Also, there is no such thing as an "ANSI C++ compliant > > compiler" > > > Of course there is. Try Intel C++ compiler for example. > > > > -- *all* > > current compilers fail the conformance tests in various ways. > > > Not all. And standard conformance is increased day by day to the rest > compilers too. Camaeu is another 100% conformant compiler > too. And there > are probably others too (perhaps GCC 3.x is 100% compliant too). > > > > This means > > that sample code inevitably needs to be modified for > > different compilers. > > > Things are improving day by day. The standard is very recent (late of > 1998) for *everything* to be implemented immediately. And C++ is a > multiparadigm language, that means it is like 4+ languages together (4 > paradigms and many space/time efficiency concerns since it is intended > for mission critical applications too (OSes, etc). > > > > "Portable" code, for the time being, requires preprocessor > > directives like > > the one shown to change the code based on which compiler is > > being used. > > > No. Simply you code for the compiler you intend to use > thinking of full > ansi C++ and then if something does not compile, you change it with > something that does. If you write a library or something and you care > for many compilers out there, i wouldn't care but code as freely as i > can knowing that since things are improving day by day everything will > be soon ok for them too. That is, i can't think of an occasion why i > would need #ifndefs for portability, and i can't think for > any possible > reason to do so. > > #ifndefs are used to make portable code using compiler extensions not > for ANSI C++ code.Ioannis > > I think you have confused ANSI C++ code with system specific > code (e.g. > Win32 library calls). > > > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > * Alternative URL: http://run.to/noicys > > > > --__--__-- > > Message: 6 > From: "Jason Hardman" <jas...@nt...> > To: "Dev-C++" <dev...@li...> > Subject: Re: [Dev-C++] merging two sorted lists using file streams... > Date: Sat, 8 Jun 2002 04:22:11 +0100 > > Quick tip: > > get 'a' > get 'b' > repeat > if 'a' is greater than 'b' > output 'b' > get 'b' > else > output 'a' > get 'a' > until one of the streams is empty > > This is a simplistic algorithm for you to follow, but it > demonstrates the way two sorted streams can > be "merged" (lookup that word in an algorithms book). There > is still one more thing for you to add: > When one of the streams runs out then you need to continue > feeding from the other and outputing it > until it is also empty. And don't forget that the streams may > be empty to start with! (tip: use a > while loop) > > It would be wise for you to figure the rest out yourself, but > one more tip: If you are repeating the > same steps several times in different places in a program, > then it's a good idea to make those steps > into a function (i.e. getFromStream(); outputToStream();). > Meaningful variable names also help > (instream_a, instream_b, outstream) > > Jason. > > PS: Not as quick a tip as I had planned, but at least I > didn't hand everything to you on a plate. > > ----- Original Message ----- > From: "chromatonus 712" <chr...@ho...> > To: <dev...@li...> > Sent: Saturday, June 08, 2002 1:48 AM > Subject: [Dev-C++] merging two sorted lists using file streams... > > > Hi, here is my program that is suppose to read one piece of > data from 2 > different sorted lists each, > > like these two text files: > > File A: > 1 > 2 > 4 > 8 > 16 > File B: > 0 > 1 > 1 > 2 > 3 > 5 > 8 > > output should be > File C: > 0 1 1 1 2 2 3 4 5 8 8 16 > > Would anyone give a sample program that performs this > function, using only > the "basic" file stream operations as in my program below? > Thank you very > much > > #include "apstring.h" > #include <iostream.h> > #include <fstream.h> > #include <conio.h> > > int main() > { > ifstream a; ifstream b; > ofstream c; > a.open("A.dat"); > b.open("B.dat"); > int ark, bum, j, k, temp; > a >> ark; > a.ignore(80,'\n'); > j = ark; > b >> bum; > b.ignore(80,'\n'); > k = bum; > if( ark < bum ) > { > c << ark << endl; > a >> ark; > a.ignore(80,'\n'); > temp = ark; > } > else > { > c << bum << endl; > b >> bum; > b.ignore(80,'\n'); > temp = bum; > } > if(j<k) > { > while( b>>bum && bum<temp ) > { > b >> bum; > b.ignore(80,'\n'); > c << bum << endl; > b >> bum; > b.ignore(80,'\n'); > } > c << temp << endl; > temp = bum; > } > else > { > while( a>>ark && ark<temp ) > { > a >> ark; > a.ignore(80,'\n'); > c << ark << endl; > a >> ark; > a.ignore(80,'\n'); > } > c << temp << endl; > temp = ark; > } > while( c << temp ) > { > cout << temp << endl; > } > system("PAUSE"); > a.close(); > b.close(); > c.close(); > > > return 0; > } > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas - > http://devcon.sprintpcs.com/adp/index.cfm?> source=osdntextlink > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > --__--__-- > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > End of Dev-cpp-users Digest > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.361 / Virus Database: 199 - Release Date: 07.05.2002 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07.05.2002 |