Is this ->> an old operator or a typo/error?
It looks like a problem in the transcription process. There is a similar problem in DR 42, where the greater than sign is doubled: http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_042.html
I learned C in 1992, and I'm 100% certain there was no such operator back then.
From the context, p->>x[5]
, we can deduce that it appears to do exactly the same thing as the more familiar arrow operator, ->
. It is therefore likely to be a typo.
Alternatively, it could be an encoding issue in transcribing the code into HTML. If you look at the source to that page, you can see it's got a strange mixture of escape codes and literal <
and >
characters:
<TT><B>#include <stdlib.h><BR>
This does seem likely to have been a transcription error, but I think it would be useful to write out how a real C compiler would interpret this construct, anyway, just to make clear that it isn't a clever trick. The first thing it's important to know is this sentence, from C11 §6.5.4p4 (technically, N1570; this language is unchanged since C89, although the section number was probably different; emphasis mine):
If the input stream has been parsed into preprocessing tokens up to a given character, the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token.
That means the six-character string " p->>x"
must be tokenized as p -> > x
, not p - >> x
or p - > > x
. (It doesn't actually matter in this case, it would be a syntax error either way, but this rule can be the difference between a program parsing as intended, and not; the standard gives the example x+++++y
, which is interpreted as x++ ++ +y
, not as x++ + ++y
, even though only the latter is a well-formed expression.)
The next thing to know is simply that the right-hand argument of the ->
operator must be an identifier, per the grammar rules for postfix-expression in §6.5.2. Obviously >
isn't an identifier, so we have a definite syntax error.