From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,94f5b26bc297a928 X-Google-Attributes: gid109fba,public X-Google-Thread: 1094ba,7a6a623afb38d7f7 X-Google-Attributes: gid1094ba,public X-Google-Thread: 103376,7a6a623afb38d7f7 X-Google-Attributes: gid103376,public From: "Gary L. Scott" Subject: Re: Fortran vs C++ vs. etc (has little to do with realtime anymore) Date: 1997/09/23 Message-ID: <342891F8.BEDBF112@flash.net>#1/1 X-Deja-AN: 275045852 References: <5ve7c6$f4m$1@info.uah.edu> <5vmbdl$v8f$1@news.iastate.edu> <5vu47d$ea8$1@news.iastate.edu> X-Priority: 3 (Normal) Organization: Home Reply-To: scottg@flash.net Newsgroups: comp.lang.c++,comp.lang.fortran,comp.lang.ada Date: 1997-09-23T00:00:00+00:00 List-Id: Oleg Krivosheev wrote: > Hi, Rick > > rhawkins@iastate.edu (Rick Hawkins) writes: > > > > > > > In article , > > Oleg Krivosheev wrote: > > > > >rhawkins@iastate.edu (Rick Hawkins) writes: > > > > >> yes!!! learning c++ after not using c for ten years took some > work. > > >> Fortran after 12 years didn't; I could sit back donw and code. > > > > >well, if you're talking about F77, yes. FYI, there are already > > >F90 and F95 here. I doubt you can program in F95 without > > >learning - just as you did with C++. > > > > I'm using F90; It was Fortran IV on a pr1me and almost-f77 on tops > 20 > > back then. > > well, that's exactly what i was asking about - there were NO > F90/F95 twelve years ago ! If you're using F90 now, you learned > it somehow. Either i misunderstood something or our claim > > "> >> Fortran after 12 years didn't; I could sit back donw and code." > > is wrong. However, a very large percentage of Fortran 90 features (even some of the new intrinsics) have been in some FORTRAN 77 compilers for minicomputers as extensions since the late 70's/early 80's. The main exceptions being array syntax and "non-sequence" derived types. So some of us have had a long time to learn them. I've used the following since around 1981: block do/end do (also for/end for, loop/end loop) ! comment free form source (almost identical to the current standard) variable # calling arguments (not F90/not keyword arguments/kinda messy) "Purdue" bit manipulation intrinsics direct physical memory address access ("Cray pointer" substitute?/not F90) ; record separator I'm sure others that I can't recall right now... That's why I have such a hard time believing how long it took to get some of them standardized and why some of them are still not in the standard (but are rumored). > > > > >cannot find max() in c++? > > > > I tried. I looked. I'm convinced it must be there, but . . . > > > > >couldn't figure how to write function with variable numbers > > >of arguments? > > > > In the two books that I had, there was a single example, whihc > managed > > not to explain. I wasn't just the issue of variable number of > > arguments, but of arbitrarily large variable numbers > > (i wanted my max()! :) > > sorry, i have only min ;) > > well, try example below for min with > arbitrary larger number of arguments. Hope it can help > > #include > #include > #include > > double > dmin( int nofargs, ... ) { > > double res = 1.0e+38, arg; > int j; > va_list ap; > > assert( nofargs > 1 ); > > va_start(ap, nofargs ); > > for( j = 0; j < nofargs; ++j ) { > arg=va_arg( ap, double ); > if ( arg < res ) { > res = arg; > } > } > va_end(ap); > return res; > } > > int > main( void ) { > > printf( "%e\n", dmin( 2, 1.0, 2.0 ) ); > > printf( "%e\n", dmin( 3, 0.0, 1.0, 2.0 ) ); > > printf( "%e\n", dmin( 5, 0.0, 1.0, 2.0, 7.0, -0.2 ) ); > > return 0; > } > > > >there is something wrong with your C++ installation > > >or with your C/C++ book. > > > > I assume it's the books; the compiler was either DEC cc or gcc; i > forget > > now. > > code above works fine with gcc on Sparc/Solaris 2.5 box > > regards > > OK