We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The following code compiles fine with C V7.20
struct { struct { char a; } t; } b; void main(void) { b.t.a=0; (&b)->t.a=0; (&(b.t))->a=0; (*) }
and gives an error with V8.05a for line (*)
TEST.C(10): error C200: left side of '->' requires struct/union pointer
FYI, It is the result of a macro a macro that expects a pointer and for which the address of a struct member was passed. GeertB
Out of interest, what does v8.05a say for
(&b.t)->a = 0;
Is it a case that &X is not the same as &(X) ... ?
"Is it a case that &X is not the same as &(X) ... ?"
It may (erroneously?) be so for v8.05a, but IMHO the reported error is unjustified.
I am happy to report that Gimpel's lint backs me up on that opinion.
FYI, Gimpel provides a "Blank Slate (C)" link where one can post these kinds of snippets to get their product's opinion:
www.gimpel-online.com/OnlineTesting.html
It represents the same as (*) (. is evaluated before &) and produces the same error with v8.05a