Liste des Groupes | Revenir à l c |
On 09/04/2025 00:27, Tim Rentsch wrote:don't forget vec4bart <bc@freeuk.com> writes:I showed this example a few lines later which has both struct tags omitted:>If you want to make a point or ask a question about C code,>
SHOW THE CODE. And show all of it. Don't make people guess
by showing only some of the code or by giving just a description.
I'm showing the code but you keep snipping it! [...]
No, I don't. Don't be so obtuse. I included the code I was
originally commenting on, in my first followup. My comment about
showing code was about your second posting. Let me repeat the two
important paragraphs (quoted above) taken from that posting:
>>I get an incompatible error (from the example you snipped) even when I
remove both struct tags.
The phrase "even when I remove both struct tags" describes code, it
doesn't show the code.
BC:
> Two typedefs for same struct layout appear to create distinct types;
> this fails:
>
> typedef struct {float x, y;} Point;
> typedef struct {float x, y;} vector;
>
> Point p;
> vector v;
>
> p=v;
But before I get there, I say:
> I can't use the same struct tag in the same scope as one will clash with
> the other.
That would be something like this:
typedef struct tag {float x, y;} Point;
typedef struct tag {float x, y;} vector;
I suggested:
> But if I have the second in an inner scope, then I again get
> the error.
That would be something like this where both 'struct tag' can co-exist:
typedef struct tag {float x, y;} Point;
{
typedef struct tag {float x, y;} vector;
... rest of example that assigns v to p
}
Les messages affichés proviennent d'usenet.