diff options
author | unknown <konstantin@mysql.com> | 2004-08-28 10:32:27 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2004-08-28 10:32:27 +0400 |
commit | ca37e1c3778cd151bf61339042767a81d8bf2369 (patch) | |
tree | 13c65391e577a6f0f6d311a89a844a981c824b95 /sql/protocol.h | |
parent | d41092796332f1a9de32c56eeff16dc8e49b69b1 (diff) | |
download | mariadb-git-ca37e1c3778cd151bf61339042767a81d8bf2369.tar.gz |
Microsoft VC++ won't compile class C { static const int I=1; }.
Putting initialization into .cc will reduce compiler's abilities
to optimize this constant away.
Defines are not OK as they bloat global namespace.
Looking for a way to declare an efficient named constant in reduced
namespace (i. e. in a class).
Let's try enums: normally they should be implicitly casted to int.
Let's see if we really have a compiler which won't do that.
libmysqld/lib_sql.cc:
Added explicit cast to int for Protocol::{SEND_DEFAULTS,SEND_NUM_ROWS,
SEND_EOF}
flags argument of send_fields() is now int.
sql/protocol.cc:
flags argument of send_fields is now int.
sql/protocol.h:
Catch22: Microsoft VC++ won't compile
class C { static const int I=1; }.
Putting initialization into .cc will reduce compiler's abilities
to optimize this constant away.
Defines are not OK as they bloat global namespace.
Looking for a way to declare an efficient named constant in reduced
namespace (i. e. in a class).
Let's try enums: normally they should be implicitly casted to int.
Let's see if we really have a compiler which won't do that.
sql/protocol_cursor.cc:
flags are now int.
Diffstat (limited to 'sql/protocol.h')
-rw-r--r-- | sql/protocol.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/protocol.h b/sql/protocol.h index 8dc2f506c6c..1a5896a3ae5 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -51,10 +51,8 @@ public: virtual ~Protocol() {} void init(THD* thd_arg); - static const uint SEND_NUM_ROWS= 1; - static const uint SEND_DEFAULTS= 2; - static const uint SEND_EOF= 4; - virtual bool send_fields(List<Item> *list, uint flags); + enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 }; + virtual bool send_fields(List<Item> *list, int flags); bool send_records_num(List<Item> *list, ulonglong records); bool store(I_List<i_string> *str_list); @@ -168,7 +166,7 @@ public: prev_record= &data; return Protocol_simple::prepare_for_send(item_list); } - bool send_fields(List<Item> *list, uint flags); + bool send_fields(List<Item> *list, int flags); bool write(); uint get_field_count() { return field_count; } }; |