Re: double confusion



On 2006-07-17 09:55:13 -0300, "Julian Bessenroth" <jbusenet@xxxxxx> said:


Ian Bush schrieb:

How is it different from C ?

If the subprogram and the main program were in different files and compiled
separately how could you ensure that the main program knows what return
type the function has ?

But these declaration are located onlz _once_ at the begining of the
file (before the main routine starts). Fortran requires its
declarations "within the main routine" and within every
subroutine/function where i'm going to use the this function, and what
confuses me somewhat more, that it's just required for double
precision, but not for integer or real ...

You could try to use an "IMPLICIT NONE" and see what happens.

When you rely on defaults one of the problems is that you have
to know what the defaults actually are. In Fortran the default types
are integer and real according to the initial letter.

Fortran has no notion of file scope so the beginning is actually the
beginning of the main program. It would be much clearer if you had used
a PRGOGRAM statement. Then you would have gotten an obscure diagnostic
about two main programs which would have indicated that something was
not quite as you had guessed it to be.

regards

Julian


.



Relevant Pages

  • Re: 2d Gaussian Quadrature
    ... > complex-valued function of two real variables. ... > Fritsch, Kahaner, and Lyness, Double Integration Using One Dimensional ... > of an adaptive routine over a single application of a gaussian ... > More recently I converted this routine to Fortran 90 and also created ...
    (comp.lang.fortran)
  • Re: Reported any bugs in C-LAPACK routine DSPEVX?
    ... >>and call the latest Fortran LAPACK routines directly. ... For the dstevx routine I do it like this. ... the declaration can be done also in a header.h file which is ... There exists other ways of including lapack routines into C. ...
    (sci.math.num-analysis)
  • Re: File reading problem
    ... Of course the software contains a routine to ... Visual Fortran would be the most natural ... Should Notepad read ascii code? ... One would assume there's somethingreadingthese output files now ...
    (comp.lang.fortran)
  • Re: fortran pointer structure
    ... From your discussion, it's quite clear that you are using, in your Fortran ... routine, the assumed-shape (hope I got that one correct - they all start ... I do know that the VAX FORTRAN compiler did this: ...
    (comp.lang.fortran)
  • Re: MBConvertMBToUnicode calls _for_write_seq_lis?
    ... I'll certainly take a look at the AllocConsole API, since having a default output device will likely be beneficial for avoiding unplanned termination and debugging in the case of other unexpected outputs as well. ... There is no good reason I can think of that this routine should be doing output of any kind. ... But in case it is of interest, I've copied a larger sample of the disassembly listing that I see when running the debugger from the Fortran IDE. ...
    (comp.lang.fortran)