[fpc-devel] Incomplete docs on operator precedence / Question about actual precedence

Martin Frb lazarus at mfriebe.de
Mon Feb 3 17:02:53 CET 2014


On 03/02/2014 15:38, Dmitry Boyarintsev wrote:
> On Mon, Feb 3, 2014 at 10:25 AM, Martin Frb <lazarus at mfriebe.de 
> <mailto:lazarus at mfriebe.de>> wrote:
>
>     It does not state if or if not it is an operator. And also give no
>     indication on its precedence, or if it is applied before or after
>     operators.
>
>     This is not so much about he -a^ (which is a (very) constructed
>     case), but about   @a^ which is possible (not doing much so)
>
>     So if {$T-}
>     a : pinteger;
>     @a^ gives an untyped pointer (same as "pointer(a)" ? / but shorter)
>     But only because it is @(a^) and not (@a)^ . The second would only
>     compile wit {$T+}
>
>
> Both still both expressions are parsed the same (not if $T is enabled 
> or not).
> If you treat ^ as a part of identified, you'll be able to parse the 
> expression.

Parsed yes, but if it comes to evaluation, then you get {$T-} (@a)^ 
"cant dereference an untyped pointer" or similar

@a^ always works. All I was asking is if the documentation should state 
it more clearly that ^ is (As part of the identifier) done before ^


Being picky:
http://www.freepascal.org/docs-html/ref/refse15.html#x46-530003.4
>
> The expression
>
>  BP^
> is known as the dereferencing of BP. The result is of type Buffer

If "BP^" is a single identifier, then where in this expression is the 
action coming from? ("dereferencing" describes an action)
Also "result" used for a single identifier seems strange. (so that is 
correct)

If on the other hand BP is the operator, and ^ is added to the operator 
(becoming a part of it), then what is ^ on its own? (more specific, than 
a token, please)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140203/297a7df1/attachment.html>


More information about the fpc-devel mailing list