hodgesse1 / rfortran

Automatically exported from code.google.com/p/rfortran
0 stars 0 forks source link

type of 'allmessages' in procedure 'getmessages' #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
*** SUGGESTION

Consider declaring argument 'allmessages' in procedure 'getmessages' as

CHARACTER(*),POINTER::

instead of

CHARACTER(msg_tag_len),ALLOCATABLE::

Benefits:

1) (*) instead of (msg_tag_len):

(a) I think assumed-length strings are safer - it is impossible to have
argument length mismatch, whereas using fixed-length string leads to stack
corruption if not detected at compile time (IVF does appear to detect it). 

(b) Forcing (msg_tag_len) forces users to have a dedicated array for
allmessages, whereas allowing other-lenth-strings means you can reuse other
char arrays for this purpose (more flexible).

2) POINTER instead of ALLOCATABLE

(a) Question of safety. At least for the moment, Fortran-95 features appear
more reliable than Fortran-2003.

*** What version of RFortran are you using?

Version 1.00 Beta

Original issue reported on code.google.com by dmitri.k...@gmail.com on 11 Aug 2009 at 5:03

GoogleCodeExporter commented 8 years ago
The allmessages (& lastmessages) arguments are now pointers and assumed length 
as 
suggested

Original comment by mark.th...@gmail.com on 4 Mar 2010 at 3:27