the_init said:
Error: E1172 Expected struct or union tag but found 0x08 at line 10.
i.e. where I have declared the structure.
Either you have a weird non-printable character in your code here, which
doesn't copy to Usenet (so try deleting the entire line and re-typing it
afresh), or your compiler is complaining, in a weird way, about you
using an identifier which starts with an underscore followed by a
capital letter.
Identifiers starting with _ and capital, and in many circumstances ones
staring with _ and anything else as well, are reserved for it (i.e., the
implementation) to use, and should not be declared by you; it is
possible that one system header has #defined _SHOW to be 0x08. Since
such identifiers are reserved for it, it is allowed to do so, and that
should not break any of your code, because you're _not_ supposed to use
them.
If it's the latter problem, a simple solution would be to replace _SHOW
with something else that does not start with _, for example with SHOW_.
An even simpler solution would be to realise that struct tags are in a
namespace of their own, so you can call it struct SHOW and this will not
conflict with your later typedef SHOW. The very simplest of solutions is
to realise that you're not referring to this struct as struct _SHOW
anywhere, so you don't need the tag at all; leaving it out would be
perfectly OK. You would then need to refer to it as SHOW, not as struct
SHOW, later on, but you're probably doing that already.
If it's not either of those problems, there may be something confusing
the compiler just before this struct declaration; but we can obviously
not tell what unless you post it.
{
unsigned char OC;
unsigned char Reserved : 5;
unsigned char DeviceNumber : 3;
unsigned char Control;
unsigned char Length[3];
} SHOW, *PSHOW;
BTW, hiding struct SHOW behind a typedef SHOW is all right if it's done
for the sake of creating an abstract data type; but typedefing a pointer
to it as well is just needless obfuscation. There's nothing wrong with
using SHOW * later on, just as there's nothing wrong with using int *
without a typedef.
Richard