mirror of
https://github.com/MariaDB/server.git
synced 2026-04-22 08:15:31 +02:00
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.
This commit is contained in:
parent
d410927963
commit
ca37e1c377
4 changed files with 8 additions and 10 deletions
|
|
@ -568,7 +568,7 @@ err:
|
|||
|
||||
C_MODE_END
|
||||
|
||||
bool Protocol::send_fields(List<Item> *list, uint flags)
|
||||
bool Protocol::send_fields(List<Item> *list, int flags)
|
||||
{
|
||||
List_iterator_fast<Item> it(*list);
|
||||
Item *item;
|
||||
|
|
@ -615,7 +615,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
|
|||
if (INTERNAL_NUM_FIELD(client_field))
|
||||
client_field->flags|= NUM_FLAG;
|
||||
|
||||
if (flags & Protocol::SEND_DEFAULTS)
|
||||
if (flags & (int) Protocol::SEND_DEFAULTS)
|
||||
{
|
||||
char buff[80];
|
||||
String tmp(buff, sizeof(buff), default_charset_info), *res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue