Re: Why this error "error C2146: syntax error : missing ';' before identifier 'Length'" by Peter
Peter
Fri Jun 03 06:42:12 CDT 2005
"iceColdFire" <icoldfire@yahoo.com> skrev i en meddelelse
news:1117773337.562397.76440@g14g2000cwa.googlegroups.com...
>I have a VC++.net Win32 console application, however when I compile , I
> get this error
>
> error C2146: syntax error : missing ';' before identifier 'Length'
>
> Explain...
>
> Location pointed is
>
> typedef struct _LIST
> {
> LPLINK Tail; //... List Tail pointer.
> LPLINK Head; //... List Head pointer.
> DWORD Length; //... List Length.
> } LIST;
>
> typedef LIST *LPLIST;
> in List.h
>
> Thanks,
> a.a.cpp
>
Probably because DWORD is an unknown type.
By the way your code is dangerous and inherently nonportable. _LIST is a
reserved identifier (as are all identifiers with a leading underscore
followed by a capital letter). Upgrading your compiler might thus break this
code.
Using all CAPITAL_LETTERS for types is also a bad habit - standard
convention requires this to be reserved for macroes.
Finally, this is not C++ but C-style, but you probably know this already.
/Peter