Struct definition in MS-C

T. William Wells bill at twwells.com
Fri Aug 18 20:18:19 AEST 1989


In article <10761 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
: In article <Aug.16.14.48.38.1989.11505 at caip.rutgers.edu> shuang at caip.rutgers.edu (Shuang Chen) writes:
: >struct node {
: >     struct node *next;
: >     };
: >as it is with standard C, but this doesn't work with MS-C.

Baloney. It works fine with Microsoft C.

: Actually that should have worked with anybody's C.
: Try something like
:       struct node;
:       struct node {
:               struct node *next;
:       };

Eh? The first example is perfectly good C. The only case I think it
might fail is with something like:

struct node {
	...
};
foo()
{
	struct node {
		struct node *next;
	};

The "struct node *" is, I think, going to refer to the global struct
node, not the local one; in that case, adding an additional "struct
node;" at the start of the function will fix things.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.lang.c mailing list