Aleksandar Donev writes:
> p=>test%t%x
> ^
> Error 103 : The target of a pointer must be a target or a pointer
>
> which I believe is wrong since test does not need the TARGET attribute
> since t is a pointer and does x inherits it implicitly from t.
Malcolm has covered the real points. As editor, let me note a few wording
issues. First, the message is just wrong. The target of a pointer
can never be a pointer - it must always be a target. Yes, you can
have a pointer on the right-hand side of a pointer assignment
statement, but in that case, the pointer on the left-hand side is
associated with the target of the pointer on the right-hand side.
It is not associated with the pointer itself. Although you might
consider this a picky point, it is exactly the kind of confusion that
leads to the kind of bug you are seeing.
Second, two wording quibbles in your explanation. I agree with your
conclusion (that the code should work and the compiler in question has
a bug), but not with the wording of your reasoning.
The component x *DOES* need to have the target attribute. What it
doesn't need is to have the target attribute explicitly declared for
the component. Indeed, there is no syntax to declare the target
attribute for a component. You clearly have the right idea here -
just the wrong expression of it. Having an attribute is not the same
thinf as that attribute appearing in the declaration. The two are
certainly related in that the appearance of an attribute in a
declaration confers the attribute in question. But there are also
other ways for something to get an attribute, so the absense of a
declaration doesn't necessarily mean the absense of the attribute.
And I wouldn't say that x inherits attributes from the pointer test%t;
I would say that x inherits attributes from it's parent, which is
the target of test%t (again here, I am meticulously distinguishing
teh pointer from its target). As Malcolm notes, there might be a
hole in the exact wording of the standard, but this is the "clear"
intent and is what the wording needs to say if it doesn't. I haven't
drug out the words in question to ponder them right now.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|