• <tfoot id='xSER4'></tfoot>
  • <i id='xSER4'><tr id='xSER4'><dt id='xSER4'><q id='xSER4'><span id='xSER4'><b id='xSER4'><form id='xSER4'><ins id='xSER4'></ins><ul id='xSER4'></ul><sub id='xSER4'></sub></form><legend id='xSER4'></legend><bdo id='xSER4'><pre id='xSER4'><center id='xSER4'></center></pre></bdo></b><th id='xSER4'></th></span></q></dt></tr></i><div id='xSER4'><tfoot id='xSER4'></tfoot><dl id='xSER4'><fieldset id='xSER4'></fieldset></dl></div>
      <bdo id='xSER4'></bdo><ul id='xSER4'></ul>

      1. <small id='xSER4'></small><noframes id='xSER4'>

      2. <legend id='xSER4'><style id='xSER4'><dir id='xSER4'><q id='xSER4'></q></dir></style></legend>

        `struct X typedef` 与 `typedef struct X` 的含义是什么?

        时间:2023-05-23

        <tfoot id='WyvXM'></tfoot>
          <bdo id='WyvXM'></bdo><ul id='WyvXM'></ul>
        • <small id='WyvXM'></small><noframes id='WyvXM'>

          • <i id='WyvXM'><tr id='WyvXM'><dt id='WyvXM'><q id='WyvXM'><span id='WyvXM'><b id='WyvXM'><form id='WyvXM'><ins id='WyvXM'></ins><ul id='WyvXM'></ul><sub id='WyvXM'></sub></form><legend id='WyvXM'></legend><bdo id='WyvXM'><pre id='WyvXM'><center id='WyvXM'></center></pre></bdo></b><th id='WyvXM'></th></span></q></dt></tr></i><div id='WyvXM'><tfoot id='WyvXM'></tfoot><dl id='WyvXM'><fieldset id='WyvXM'></fieldset></dl></div>

                    <tbody id='WyvXM'></tbody>
                1. <legend id='WyvXM'><style id='WyvXM'><dir id='WyvXM'><q id='WyvXM'></q></dir></style></legend>
                2. 本文介绍了`struct X typedef` 与 `typedef struct X` 的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在现有代码库中有以下(工作)代码,在 C 和 C++ 之间共享的包含文件中使用,在 MSVC (2010) 和 Windows DDK 上编译:

                  I have the following (working) code in an existing code base, used in include file that is shared between C and C++, compiling on MSVC (2010) and Windows DDK:

                  struct X {
                      USHORT x;
                  } typedef X, *PX;
                  

                  还有:

                  enum MY_ENUM {
                      enum_item_1,
                      enum_item_2 
                  } typedef MY_ENUM;
                  

                  据我所知,正确的定义应该是这样的:

                  As far as I know, correct definition should look like this:

                  typedef struct {
                      USHORT x;
                  } X, *PX;
                  

                  下面的表格有什么目的吗?我错过了什么吗?

                  Is there any purpose for having the form below? Am I missing something?

                  推荐答案

                  typedef <别名>typedef 是有效的,仅来自语言语法定义.

                  The fact that both typedef <type> <alias> and <type> typedef <alias> are valid simply comes from the language grammar definition.

                  typedef 被归类为 storage-class specfifier(就像 staticauto),并且类型本身被称为类型说明符.从标准第 6.7 节中的语法定义中,您会看到这些可以自由互换:

                  typedef is classified as a storage-class specfifier (just like static, auto), and the type itself is known as the type-specifier. From the syntax definitions in section 6.7 of the standard, you'll see that these are free to be interchanged:

                  declaration:
                      declaration-specifiers init-declarator-list ;
                  
                  declaration-specifiers:
                      storage-class-specifier declaration-specifiers
                      type-specifier declaration-specifiers
                      type-qualifier declaration-specifiers
                      function-specifier declaration-specifiers
                  
                  init-declarator-list:
                      init-declarator
                      init-declarator-list , init-declarator
                  
                  init-declarator:
                      declarator
                      declarator = initializer
                  

                  (当然,请注意,这对于结构体和非结构体同样适用,这意味着 double typedef 麻烦; 也是有效的.)

                  (Note, of course, that this is equally true for structs and for non-structs, meaning that double typedef trouble; is also valid.)

                  这篇关于`struct X typedef` 与 `typedef struct X` 的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 C++ 中以编程方式将资源加载为字节数组 下一篇:应该 std::unique_ptr<void>被允许

                  相关文章

                  最新文章

                3. <legend id='Vsj2r'><style id='Vsj2r'><dir id='Vsj2r'><q id='Vsj2r'></q></dir></style></legend>
                  <tfoot id='Vsj2r'></tfoot>
                      <bdo id='Vsj2r'></bdo><ul id='Vsj2r'></ul>

                      <small id='Vsj2r'></small><noframes id='Vsj2r'>

                      <i id='Vsj2r'><tr id='Vsj2r'><dt id='Vsj2r'><q id='Vsj2r'><span id='Vsj2r'><b id='Vsj2r'><form id='Vsj2r'><ins id='Vsj2r'></ins><ul id='Vsj2r'></ul><sub id='Vsj2r'></sub></form><legend id='Vsj2r'></legend><bdo id='Vsj2r'><pre id='Vsj2r'><center id='Vsj2r'></center></pre></bdo></b><th id='Vsj2r'></th></span></q></dt></tr></i><div id='Vsj2r'><tfoot id='Vsj2r'></tfoot><dl id='Vsj2r'><fieldset id='Vsj2r'></fieldset></dl></div>