...> A common bug in my code is to mistakenly use an optionalargument that is... subroutine foo(i) integer, intent(in), optional :: i integer :: i_ if (present(i)) then i_ = i else i_ = 0 ... The "print*,i" code does not look wrong in isolation, so I find ... for the use of an optionalargumentnot wrapped within an if(present(variable)) ...
...bug in my code is to mistakenly use an optionalargument...subroutine foo(i) integer, intent(in), optional :: i integer :: i_ if...The "print*,i" code does not look wrong in isolation, so...use of an optionalargumentnot wrapped within an if(present...my pointer-containing derived type argument intents are OUT when I...length of the way. I haven't used fUnit for generating...
A common bug in my code is to mistakenly use an optionalargument that is ... as in subroutine foo(i) integer, intent(in), optional :: i integer :: i_ if (present(i)) then i_ = i else i_ = 0 ... subroutine foo The "print*,i" code does not look wrong in isolation, so I find ...for the use of an optionalargumentnot wrapped within an if(present(variable)) ...
...variable if the actual isn't present. Back many years ago, when I...syntax already: subroutine foo (optarg) integer, optional :: optarg = 0 Personally, I'd ... value is what?) Modula 3 uses a similar synatx: PROCEDURE BN2Text( ...: BigNum; isFirst := TRUE ) If the argument 'isFirst' is omitted, then you ...t accidentally modify an INTENT(IN), OPTIONALargument (as you can in ...
Steve Lionel wrote: (snip on optionalarguments) Heck, we even have the syntax already: subroutine foo (optarg) integer, optional :: optarg = 0 R puts it in the...d find this easier to explain and use than a dynamically created local variable ... is what?) In OS/360 Fortran, scalar arguments are static local variables. Not that there are optionalarguments, but the effects ...
... nearly all my procedures have an optionalargument "message_log" which is passed to a message display routine. If it's notpresent, output is to stdout, ... based on the value of an argument, with non-prtesence being equivalent to..., I'd have something like Use the file name if it is...for blank only if it was present. -- Richard Maine | Good judgement comes ...
...variable if the actual isn't present.... But doesn't this "delocalise" ... all my procedures have an optionalargument "message_log" which is passed ... display routine. If it's notpresent, output is to stdout, ... the name specified in the optional arg. If the main routine ... is that you can use the present() intrinsic on it. I ... they are passed as actual arguments. That's inherent in all ...
... to substitute for a non-present actual is extremely common. I've ...the actual was notpresent. You'd then just be using the ... main call sub !-- Note no arguments. contains subroutine sub(x) real, ... local_if_missing above; that's definitely not an actual syntax proposal. The ... all my procedures have an optionalargument "message_log" which is passed ...
...variable to substitute for a non-present actual is extremely common. I've...have an attribute for an optional dummy argument that makes the dummy argument...the actual was notpresent. You'd then just be using the ... main call sub !-- Note no arguments. contains subroutine sub(x) real, ...for local_if_missing above; that's definitely not an actual syntax proposal. The ...
... <beliavsky@aol.com> wrote: A common bug in my code is to mistakenly use an optionalargument that is notpresent. At the beginning..., which would reduce the chance of using the wrong one. Also, since the copy...you would be very unlikely to accidentally use. But both of those proposals have effects... of the routine in question. Dummy argument names matter for keyword forms of ...