(j3.2006) zero-sized stuff

Walt Brainerd walt.brainerd
Wed Mar 18 20:35:33 EDT 2015


So if I understand this correctly, with the first assignment
character string c gets its length from the expression, but
not the value (not that it matters), but with the second
assignment statement c does not get a value because it
is zero length. I don't see any exception for an allocatable
string. Now what am I missing?

program f
character(len=:), allocatable :: c
c = ""
print *, len(c), "X"//C//"X"
c = "QQQ"
print *, len(c), "X"//C//"X"
end program f

On Wed, Mar 18, 2015 at 4:43 PM, Robert Corbett <robert.corbett at oracle.com>
wrote:

> On 03/18/15 16:10, Walt Brainerd wrote:
> > 7.2.1.3(1) of the F08 standard says:
> >
> > No value is assigned to the variable if it is of type character and zero
> > length, or is an array of size zero.
> >
> > It is still in N2014, if that is the latest.
> > I think it is plain false unless there is a very strange
> > definition of "value" somewhere that I don't see.
> >
> > It sounds like the variable is unchanged.
> >
> > Maybe a note if people are confused by zero-sized things?
>
> I think the "it" in the quoted sentence refers to the variable, not the
> value.
>
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>



-- 
Walt Brainerd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20150318/95965da0/attachment-0001.html 



More information about the J3 mailing list