All: I have run into an issue that has me slightly feeling a bit nutty; when I write a structure which has a nested struct and UNION in this manor:


_PCI_HEADER_TYPE_0 STRUCT 
  BaseAddresses	 ULONG PCI_TYPE0_ADDRESSES
  Reserved1	 ULONG 2 
  ROMBaseAddress ULONG ?
  Reserved2	 ULONG 2 
  InterruptLine	 UCHAR ?
  InterruptPin	 UCHAR ?
  MinimumGrant	 UCHAR ?
  MaximumLatency UCHAR ?
_PCI_HEADER_TYPE_0 ENDS

type0 TYPEDEF _PCI_HEADER_TYPE_0


_PCI_COMMON_CONFIG	STRUCT
  VendorID	USHORT 	?
  DeviceID	USHORT 	?
  Command	USHORT 	?
  Status	USHORT 	?
  RevisionID	UCHAR 	?
  ProgIf	UCHAR 	?
  SubClass	UCHAR 	?
  BaseClass	UCHAR 	?
  CacheLineSize	UCHAR 	?
  LatencyTimer	UCHAR 	?
  HeaderType	UCHAR 	?
  BIST		UCHAR 	?
  u	UNION
    type0 <>
  u	ENDS
  DeviceSpecific UCHAR  192d	DUP(0)
_PCI_COMMON_CONFIG	ENDS

I get this error from ML.EXE: NTPCIINFO.INC(103) : error A2008: syntax error : _u NTPCIINFO.INC(105) : fatal error A1010: unmatched block nesting : _u However, if I make the following changes:

_PCI_HEADER_TYPE_0 STRUCT 
  BaseAddresses	 ULONG PCI_TYPE0_ADDRESSES	DUP(0)
  Reserved1	 ULONG 2 			DUP(0)
  ROMBaseAddress ULONG ?
  Reserved2	 ULONG 2 			DUP(0)
  InterruptLine	 UCHAR ?
  InterruptPin	 UCHAR ?
  MinimumGrant	 UCHAR ?
  MaximumLatency UCHAR ?
_PCI_HEADER_TYPE_0 ENDS

type0 TYPEDEF _PCI_HEADER_TYPE_0

_u	UNION
    type0 <>
_u	ENDS

_PCI_COMMON_CONFIG	STRUCT
  VendorID	 USHORT ?
  DeviceID	 USHORT ?
  Command	 USHORT ?
  Status	 USHORT ?
  RevisionID	 UCHAR 	?
  ProgIf	 UCHAR 	?
  SubClass	 UCHAR 	?
  BaseClass	 UCHAR 	?
  CacheLineSize	 UCHAR 	?
  LatencyTimer	 UCHAR 	?
  HeaderType	 UCHAR 	?
  BIST		 UCHAR 	?
  _u <>
  DeviceSpecific UCHAR  192d	DUP(0)
_PCI_COMMON_CONFIG	ENDS

PCI_COMMON_CONFIG 	TYPEDEF _PCI_COMMON_CONFIG
PPCI_COMMON_CONFIG	TEXTEQU  
All is well. The reason behind this post, and my question, is why would the first form generate such an error yet the second form work just fine?
Posted on 2001-04-30 20:07:00 by madprgmr