[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3117.0. "Fortran vs. C for DECwindows Programming" by MUTTON::LAMB (Peter Lamb - FSG Santa Clara) Mon Jul 23 1990 19:34

Hello,

A customer asked me today if I could give them any performance related reasons 
for choosing VAX C over VAX Fortran for the development of their DECwindows 
applications.  

I pointed out the obvious reason for choosing C over Fortran for purely support
& documentation reasons.  However, their programming staff is much more 
comfortable with Fortran and if there aren't any clear cases where C wins over 
Fortran performance wise (with respect to DECwindows applications) they will 
choose Fortran.

I should note that they are already doing some DECwindows programming in Fortran
and are so far disappointed in the performance and are now thinking that maybe
they should switch to C.

Any and all information appreciated.

Regards,

Peter Lamb
T.RTitleUserPersonal
Name
DateLines
3117.1a little help...GSRC::WESTSCARY : A programmer with a screwdriver.Mon Jul 23 1990 20:1625
  One performance issue is the fact that the DECwindows routines are written
in C.  A C program calls routine XMumble directly...for all other languages
including FORTRAN, FORTRAN calls an intermediate routine that in turn calls
the C routine.

  This is known as the VAX VMS $ Binding.  These routines do things like
append/remove the ASCII null character to/from strings, and address
dereferencing, that are otherwise painful for some languages to do on their
own.

  Another issue (maybe) is the difference between the RTL executions of C
over FORTRAN, (i.e.  how much work is involved in running a FORTRAN program
compared to running a C program)

  Overall, however, I wouldn't think that there would be _that_ big of a
difference in performance.  This is based on my experience of writing/re-writing
some common programs in Ada that have C counter-parts and no notice no real
differences in performance.

  I know this isn't much but I thought I'd try to help.  :^)


						-=> Jim <=-

3117.2QUARK::LIONELFree advice is worth every centMon Jul 23 1990 20:3221
I'm not sure what Jim West is referring to regarding the "RTL executions".
Though it's true that in most cases there is a level of call indirection
when calling the "VAX binding" toolkit routines, I don't think this would
have any noticeable performance impact.  If you thought it did, there's
nothing to stop you from using the C bindings - actually, from FORTRAN it's
not hard at all.  You'll just have to learn to manipulate null-terminated
strings a bit more (you can't avoid it even with the VAX bindings).

There is no inherent advantage to programming in C for DECwindows.  If your
customers are comfortable with FORTRAN, then by all means encourage them
to use it.  They may want to consider calling the "C binding" routines
for portability reasons; the data structures from the DEC-supplied
packages are not a problem.  The only problem I see is pointers, and these
too can be dealt with in FORTRAN without too much difficulty.

As for overall performance, FORTRAN will generally win over C.  Coupled with
the software engineering advantages of FORTRAN (or just about anything else)
over C, the customer's overall development and maintenance costs will be lower
with FORTRAN. 

					Steve
3117.3Motif?OSLACT::OLAVDo it in parallel!Wed Jul 25 1990 07:5721
> There is no inherent advantage to programming in C for DECwindows.

C is more used in the world of X programming. It's easier to get support when
doing it in C. Motif has currently support for C *only*. It's a lot easier to
code in C since the toolkit is written in C.

> As for overall performance, FORTRAN will generally win over C.

I think the difference would be marginal. Use the tools that keeps the
development and maintenance costs down. Select a hardware platform that gives
you the performance you need.

> Coupled with the software engineering advantages of FORTRAN (or just about
> anything else) over C, the customer's overall development and maintenance costs
> will be lower with FORTRAN.

I don't see any connection between software engineering advantages and FORTRAN?
Too me it's no better than C. C has a interesting migration into object oriented
programming with C++. What about FORTRAN?

Olav
3117.4I learned C just to program for DECwindows...DSSDEV::BIBEAULTGrizzly BearWed Jul 25 1990 12:3916
>> As for overall performance, FORTRAN will generally win over C.
>
>I think the difference would be marginal.

    FORTRAN will *in general* yield slightly better performance than C (I
    agree that it'll usually be marginal, and it's not true for ALL cases),
    but remember that you pay the price in virtual memory since FORTRAN 
    pre-allocates everything.

    Although I am *not* a fan of C, I'd recommend doing any DECwindows
    programming in that language for quite a few reasons. One of the
    strongest is the wealth of example programs that exist, mostly written
    in C. Countless times I've SEARCHed (grep'd) example source files looking
    for an example of how something was done...

-mike
3117.5QUARK::LIONELFree advice is worth every centWed Jul 25 1990 14:2720
So the argument is "use C because everyone else does"?  The information I have
says that much of our customer base is using Ada and FORTRAN more than C
for DECwindows applications.

The only reason there aren't more examples in other languages is that nobody
has bothered to write them.  That's why I developed the Ada and FORTRAN
versions of HELLOWORLD and DECBURGER, and the Ada version of XLIBINTRO.
More will be forthcoming.

As for Motif, I am aware that we don't currently have a binding package for
any language but C.  If we allow this to continue, we are going to cause our
paying customers untold grief.  I'm working behind the scenes on this, and
believe that we'll at least have Ada and FORTRAN bindings for Motif.

Don't let others make choices for you.  If you believe strongly in the need
to use high-level languages for DECwindows/Motif applications, make your
desires known to product management.  It would be sad if we were forced to
program in C just because we didn't speak up.

				Steve
3117.64GL::VANNOYJake VanNoyWed Jul 25 1990 21:344
    The actual data I've seen says that the TSC calls are a high
    percentage FORTRAN and Ada, but this may only be an indication of the
    state of those bindings or a lack of examples in those languages. It
    does not necessarily reflect usage.
3117.7DSSDEV::BIBEAULTGrizzly BearThu Jul 26 1990 13:2012
Steve,

> So the argument is "use C because everyone else does"? 

   Not at all what I said. I'm just a big believer in using the most appropriate
   tool for the job. And although I have some serious problems with C as a
   language, at least for now it's the easiest to program to DECwindows in.
   The originator of this note asked for opinions -- that's mine. You're also
   entitled to yours. It's now up to him to weigh these opinions against his 
   situation...

-mike
3117.8SMAUG::MENDELIn some strange power's employThu Jul 26 1990 17:4627
>>>   > So the argument is "use C because everyone else does"? 
>>>
>>>   Not at all what I said. I'm just a big believer in using the most appropriate
>>>   tool for the job. And although I have some serious problems with C as a
>>>   language, at least for now it's the easiest to program to DECwindows in.

        But that's what it boils down to.

	Use C because it is the easiest language to program to DECwindows in.

	C is the easiest language, because the X code was written in C, because
	the X developers used C.

	C is the easiest language, because the DwT code was written in C, 
	because the DwT developers used C.

	C is the easiest language, because the examples are mostly in C, because
	the example creators used C. 

        Therefore, C is the easiest language for DECwindows because everyone 
	uses C.

	Therefore, you should use C because everyone uses C.

	QED.

        Kevin
3117.9What about macro?H2SO4::GERSBACHEdwin Gersbach CS SwitzerlandFri Jul 27 1990 13:1316
Re .8

>>> But that's what it boils down to.

Yes indeed, and because most of VMS is written in macro we should use use macro
to write our applications. What a lot of people forget is that C is the 
assembler of UNIX, and because operating systems are usually written using
assemblers does not mean that this is also useful for applications. C is, and
always was, a low level language, intended to write operating systems, drivers
and similar tasks.

Also, it is a well known fact that the overall development time for applications
is significantly higher when using C than using a structured high level language
such as ADA or Pascal.

	Edwin
3117.10PSW::WINALSKICareful with that VAX, EugeneFri Jul 27 1990 19:474
Can we please take the "merits and demerits of various programming languages"
debate to the LANGUAGES conference and get back to talking about DECwindows?

--PSW
3117.11TO PORT OR NOT TO PORT...THAT IS THE QUESTIONCSCOA3::HOOD_DOFri Aug 03 1990 13:3814
    
    Okay.... there is no clear consensus that programming in C yields
    any significant advantage in the VAX/VMS arena. I can tell you that
    if you want to port to Ultrix (and possibly many other Unix platforms), 
    the port will be easier of the program was written in C. If your
    customer will ALWAYS run the program on VMS only, choose what is 
    easiest for them to program in. (As an excercise in futility, try 
    getting documentation/examples/etc. of DECwindows programs written
    in Fortran for Ultrix. All you get is a blurb about jacket routines 
    and  their compilers.... the rest is up to you). 
    
    DH