Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: It Hurts Wh...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 30 of 50 Topic 8152 of 8775
Post > Topic >>

Re: It Hurts When I Do This

by Dick Hendrickson <dick.hendrickson@[EMAIL PROTECTED] > Apr 21, 2008 at 07:29 PM

Richard Maine wrote:
> Beliavsky <beliavsky@[EMAIL PROTECTED]
> wrote:
> 
>> The blog entry mentions a problem that combines allocation upon
>> assignment (new in Fortran 2003) and array sections. Although some
>> compilers now sup****t a line of code
>>
>> A = B
>>
>> where A is declared ALLOCATABLE and is here allocated to the shape of
>> B and then assigned to it, I am wary of using this feature, because
>> assignments in Fortran, up to now, have been separated from
>> allocations (unless I am mistaken),
> 
> Depends what you mean by "up to now". That particular variant of
> allocate-on-assignment is new to f2003. But allocation of allocatable
> components on assignment is an integral part of the allocatable TR.
> Allocatable components pretty much don't work without that. Admitedly,
> the alocatable TR isn't exactly very old.
> 
> The fact that there was already such allocation for components was one
> of the arguments for adding the feature to objects that weren't
> components. It seemed inconsistent to have automatic reallocation for
> one, but not the other. It also seemed like it would invite people to
> add the superfluous complication of putting things in a derived type
> just to get the automatic allocation.
> 
>> I wonder what people think of this style suggestion.
> 
> I repeat my unanswered question to... (I forget who; someone else in
> this thread): what about allocatable strings? It has been my observation
> that the rather large majority of people intuitively expect strings to
> act like the new allocatable ones will. They expect that
> 
>   string = 'hello'
> 
> will end up with string being 4 characters in length. They have to be
> carefully trained to understand how Fortran fixed-length strings work.

C programmers might expect 4.  Most Fortran people will expect 5 ;).

Dick Hendrickson
> 
> I expect allocatable strings to eventually become almost the norm, with
> fixed-length strings reserved for special cases.
> 
> So I wonder whether you would also extend your style choice to
> allocatable strings. I personally think that the automatic reallocation
> is more intuitive than the current scheme, which is (a bit
> inconsistently)
> 
> 1. For strings, pad or truncate to make things work. It is never an
> error.
> 
> 2. For arrays, if the size wasn't pre-allocated just right, it is an
> error.
> 
> I think it is much more natural that, if someone writes
> 
>   X = something
> 
> then they probably want X to end up having the same size or length as
> the something. I think that the resistance to this reflects being
> trained in prior Fortran practice, as distinguished from ab initio
> reevaluations of natural useability. Alternatively, maybe it's just that
> my intuition is different.
>
 




 50 Posts in Topic:
It Hurts When I Do This
GaryScott <garylscott@  2008-04-18 09:03:06 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-18 09:27:27 
Re: It Hurts When I Do This
GaryScott <garylscott@  2008-04-18 10:53:28 
Re: It Hurts When I Do This off topic
Dick Hendrickson <dick  2008-04-18 20:58:21 
Re: It Hurts When I Do This off topic
Steve Lionel <steve.li  2008-04-19 00:14:48 
Re: It Hurts When I Do This off topic
glen herrmannsfeldt <g  2008-04-18 16:39:41 
Re: It Hurts When I Do This off topic
Dick Hendrickson <dick  2008-04-19 02:03:35 
Re: It Hurts When I Do This off topic
Steve Lionel <steve.li  2008-04-19 12:21:24 
Re: It Hurts When I Do This off topic
"James Van Buskirk&q  2008-04-18 18:34:10 
Re: It Hurts When I Do This off topic
Dick Hendrickson <dick  2008-04-19 02:21:26 
Re: It Hurts When I Do This
none <none@[EMAIL PROT  2008-04-18 19:25:29 
Re: It Hurts When I Do This
Clive Page <junk@[EMAI  2008-04-18 19:32:15 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-18 13:03:45 
Re: It Hurts When I Do This
GaryScott <garylscott@  2008-04-18 13:14:28 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-18 13:54:56 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-18 13:12:10 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-18 14:43:23 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-18 14:24:32 
Re: It Hurts When I Do This
Dick Hendrickson <dick  2008-04-18 21:09:45 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-18 12:43:04 
Re: It Hurts When I Do This
GaryScott <garylscott@  2008-04-18 15:41:56 
Re: It Hurts When I Do This
GaryScott <garylscott@  2008-04-18 15:43:51 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-18 15:55:51 
Re: It Hurts When I Do This
fj <francois.jacq@[EMA  2008-04-19 03:47:57 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-19 08:28:07 
Re: It Hurts When I Do This
Ron Shepard <ron-shepa  2008-04-19 10:52:58 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-19 08:59:50 
Re: It Hurts When I Do This
Beliavsky <beliavsky@[  2008-04-21 11:06:09 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-21 12:13:11 
Re: It Hurts When I Do This
Dick Hendrickson <dick  2008-04-21 19:29:02 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-21 11:52:12 
Re: It Hurts When I Do This
Dan Nagle <dannagle@[E  2008-04-21 20:25:04 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-21 15:25:50 
Re: It Hurts When I Do This
Beliavsky <beliavsky@[  2008-04-21 11:10:27 
Re: It Hurts When I Do This
Arjen Markus <arjen.ma  2008-04-21 12:45:28 
Re: It Hurts When I Do This
Beliavsky <beliavsky@[  2008-04-21 12:53:06 
Re: It Hurts When I Do This
Beliavsky <beliavsky@[  2008-04-21 13:05:55 
Re: It Hurts When I Do This
nospam@[EMAIL PROTECTED]   2008-04-21 15:25:50 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-21 14:58:15 
Re: It Hurts When I Do This
Steve Lionel <steve.li  2008-04-22 01:12:20 
Re: It Hurts When I Do This
glen herrmannsfeldt <g  2008-04-21 19:36:49 
Re: It Hurts When I Do This -- diversion...
dpb <none@[EMAIL PROTE  2008-04-22 09:37:11 
Re: It Hurts When I Do This -- diversion...
Steve Lionel <Steve.Li  2008-04-22 11:44:31 
Re: It Hurts When I Do This -- diversion...
dpb <none@[EMAIL PROTE  2008-04-22 11:28:33 
Re: It Hurts When I Do This -- diversion...
Steve Lionel <Steve.Li  2008-04-22 16:13:37 
CVF help -- was: Re: It Hurts When I Do This -- diversion...
dpb <none@[EMAIL PROTE  2008-04-22 15:27:08 
Re: CVF help -- was: Re: It Hurts When I Do This -- diversion...
Steve Lionel <Steve.Li  2008-04-22 16:43:38 
Re: CVF help -- was: Re: It Hurts When I Do This -- diversion...
dpb <none@[EMAIL PROTE  2008-04-22 18:51:06 
Re: CVF help -- was: Re: It Hurts When I Do This -- diversion...
"Jugoslav Dujic"  2008-04-23 09:35:40 
Re: CVF help -- was: Re: It Hurts When I Do This -- diversion...
dpb <none@[EMAIL PROTE  2008-04-23 08:58:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 3:18:06 CDT 2008.