Jean Vezina wrote:
> To all:
>
> I have the following program that is rejected by
> a compiler:
>
> character*10 a
> character*3 abc(5)
> a = '5*abc'
> read(a,*)abc
> print *,abc
> end
>
> What causes the problem is the string 5*abc
>
> Is it allowed to have a repeat count before
> an undelimited character string ?
That *ought* to be legal. The standard says that an undelimited
string may not begin with digits followed by an asterisk. That's
because those characters *should* be interprested as a repeat count.
Here your intent is not that the undelimited string contain the digits
and the asterisk, but that they really be interpreted as a repeat count.
So, it should be alright. But, the standard *could* be interpreted
to disallow it. The standard is sometimes a little short on clarifications
especially in cases where it phrases things negatively: "If the next
effective item is of type default character and ... the leading characters
are not digits followed by an asterisk ... the delimiting apostrophes
or quotation marks are not required." On the other hand, simple logic
should apply: if a repeat count is not allowed on an undelimited string,
why can't such a string begin with digits and an asterisk?
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
|