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.
accidenttrainwreck or... I have no freaking idea. – R. Martinho Fernandes Oct 24 '12 at 13:30