home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 14 Text / 14-Text.zip / C6_BUGS.ZIP / C6_20083.BUG < prev    next >
Text File  |  1990-09-11  |  1KB  |  57 lines

  1. Q64686 Nested Nameless Structs Can Cause C2030 Error
  2. Microsoft C Compiler (C)
  3. 6.00   | 6.00
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. Using the same nameless structure as a member of two different
  9. structures will cause the compiler error: C2030: 'varname':
  10. struct/union member redefinition. The code sample below reproduces the
  11. error:
  12.  
  13. Sample Code
  14. -----------
  15.  
  16. #include <stdio.h>
  17.  
  18. void main(void)
  19.  {
  20.  
  21.    struct s1
  22.      {
  23.        int a,b,c;
  24.      };
  25.  
  26.    struct s2
  27.      {
  28.        struct s1;
  29.        float y;
  30.        char str[10];
  31.      } *p_s2;
  32.  
  33.    struct s3
  34.      {
  35.        struct s1;
  36.        float z;
  37.        char a[10];
  38.      } *p_s3;
  39.  }
  40.  
  41. The error message names the structure member following the nameless
  42. struct. A second nameless struct may be used only if it contains
  43. different fields than the first nameless struct.
  44.  
  45. Examples of nameless structures and unions are given on Page 434 of
  46. the "Advanced Programming Techniques" book provided with C version
  47. 6.00. There is also mention of this problem in the README.DOC file.
  48.  
  49. Microsoft has confirmed this to be a problem in C version 6.00. We are
  50. researching this problem and will post new information here when it
  51. becomes available.
  52.  
  53. Keywords:  buglist6.00
  54.  
  55. COPYRIGHT Microsoft Corporation, 1990.
  56. Updated  90/08/17 06:10
  57.