From: Michael Widenius Date: June 27 2009 8:50am Subject: Re: MySql coding style: Request for deprecation of UPPERCASE typedefs List-Archive: http://lists.mysql.com/internals/37020 Message-Id: <19013.56671.196513.125902@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "Mats" == Mats Kindahl writes: >>> Actually, I think that is a productive use of engineer time. I tried >>> to work out >>> the dependencies of lex.h (to make it self-sufficient), and this is >>> what I got: >>> >>> class Table_ident; /* Need to be before include of sql_yacc.h */ >>> class Item_num; >>> class String; >>> class Key_part_spec; >>> struct TABLE_LIST; >>> typedef struct st_udf_func udf_func; >>> typedef struct st_lex_user LEX_USER; >>> #include "sql_list.h" /* Pull in List<> */ >>> #include "set_var.h" /* Pull in sys_var_with_base */ >>> #include "sql_yacc.h" /* Pull in symbol definitions */ >>> >>> For each line, I had to do a symbol search to find the definition of >>> it and see >>> how and where it was defined. Most other files have similar >>> dependencies... >>> >>> /Matz >> >> wow! >> Each header file should have been self-contained of course, there should >> be no need for forward declarations before #include Mats> ... except in some special circumstances, of course. Mats> However, the problem is that we have the following different ways of introducing Mats> type definitions: Mats> typedef struct st_whatever { ... } WHATEVER; Mats> struct WHATEVER { ... }; Mats> class WHATEVER { ... }; Mats> However, this means that in order to be able to use forward declarations without Mats> having to look them up every time, we should standardize on "class Whatever" and Mats> change all existing code so that it matches. I think that it's better to never use forward declarations at all and instead always, if possible, us the file where the declarations is made. This eliminates typo errors and late linker errors that can be very confusion. For example, forward declarations can causes a lot of problems if one does a name changes or uses macros. Regards Monty