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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: 103376,7a6a623afb38d7f7 X-Google-Attributes: gid103376,public X-Google-Thread: 1094ba,7a6a623afb38d7f7 X-Google-Attributes: gid1094ba,public From: Oleg Krivosheev Subject: Re: Fortran vs C++ vs. etc (has little to do with realtime anymore) Date: 1997/09/23 Message-ID: #1/1 X-Deja-AN: 274890546 Sender: kriol@drabble.fnal.gov References: <5ve7c6$f4m$1@info.uah.edu> <5vmbdl$v8f$1@news.iastate.edu> <5vu47d$ea8$1@news.iastate.edu> To: rhawkins@iastate.edu Organization: FERMILAB, Batavia, IL Newsgroups: comp.lang.c++,comp.lang.fortran,comp.lang.ada Date: 1997-09-23T00:00:00+00:00 List-Id: 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. > >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