In the course of my reading I came accross WG14 Defect Report #51 written in 1993 (or perhaps 1893, they left off the century and millennium). In the code sample there, apparently an operator spelled ->>
is used on a pointer to a struct
. I can't find it in any operator precedence tables I've found, so I am wondering, is or was it ever an operator, and if so, what does (or did, as the case may be) this operator do?
At first I thought it was a typo, but it is reproduced twice more in the text and another time in the code sample in the response to the question, and I have a hard time believing it just slipped past at least two C experts without being noticed, when it jumped out at a novice like me. It's also at the focal point of the code, very easy to notice, and was never corrected.
Here is the code with added indentation:
#include <stdlib.h> struct A { char x[1]; }; main() { struct A *p = (struct A *) malloc(sizeof(struct A) + 100); p->>x[5] = '?'; /* This is the key line [for both them and us] */ return 0; }
I tried to compile this code with both a C and C++ compiler and it failed to parse in either one. Perhaps this was some operator in an early version of C that isn't used any more?
This feels suspiciously like the What is the name of this operator: "-->"? question, but I don't think this is a combination of two other operators, I don't see how it can be divided up and be valid.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With