2 messages in com.mysql.lists.plusplusRe: [Re: deprecated]
FromSent OnAttachments
Jim Peden04 Nov 2002 13:55 
Bryan W. Headley04 Nov 2002 16:00 
Subject:Re: [Re: deprecated]
From:Bryan W. Headley (bwhe@earthlink.net)
Date:11/04/2002 04:00:36 PM
List:com.mysql.lists.plusplus

Jim Peden wrote:

Bryan and others,

Well here is what happens when I use JUST the mysql++-gcc-3.0.patch. Once again I am running gcc 3.1. under Redhat 7.2.

When I compile after I have done the patch, automake, autoconf, ./configure. I get the following:

make all-recursive make[1]: Entering directory `/home/jpeden/work/mysqlAPI/mysql++-1.7.9' Making all in sqlplusint make[2]: Entering directory `/home/jpeden/work/mysqlAPI/mysql++-1.7.9/sqlplusint' /bin/sh ../libtool --mode=compile c++ -DHAVE_CONFIG_H -I. -I. -I.. -I. -I../sqlplusint -I/usr/include/mysql -g -O2 -c coldata.cc mkdir .libs c++ -DHAVE_CONFIG_H -I. -I. -I.. -I. -I../sqlplusint -I/usr/include/mysql -g -O2 -Wp,-MD,.deps/coldata.pp -c -fPIC -DPIC coldata.cc -o .libs/coldata.lo In file included from /usr/local/include/g++-v3/backward/ostream.h:31, from null1.hh:4, from coldata1.hh:10, from coldata2.hh:5, from coldata3.hh:12, from coldata4.hh:6, from coldata.cc:3: /usr/local/include/g++-v3/backward/backward_warning.h:32:2: warning:

You will get these because the library _is_ using deprecated headers. You can do a -Wno-deprecated to shut up the messages.

Now before you or anyone else asks, I'm in favor of ditching ALL deprecated headers, and going with the new functionality. It's a litle bit difficult because of the interaction of the Query's <<operator().

If you want the new C++ header functionality, mysqlcppapi-2.0 (mysqlcppapi.sf.net) diverged from MySql++, and has recently been upgraded. The differences in the API are minor, if you want to go that route.

connection.cc:26: default argument given for parameter 6 of ` MysqlConnection::MysqlConnection(const char*, const char*, const char*, const char*, unsigned int, char = 0, unsigned int = 60, bool = true, const

Correct. You may know that in C++, you can specify default values for certain parameters in a function call. In previous compilers, it didn't matter that you specify the defaults in the header, the source file, or both. Now it matters. They can only be specified in the header. So, you go through connection.cc, and see,

Connection::Connection (const char *db, const char *host, const char *user, const char *passwd, uint port, my_bool compress = 0, unsigned int connect_timeout = 60, bool te = true, const char *socket_name = "", unsigned client_flag = 0)

All it's saying is, change the 'unsigned int connect_timeout = 60,' to 'unsigned int connect_timeout,' (and the other parameters with defaults, such as te, socket_name, and client_flag likewise,) and it'll be happy. There are several functions in connection.cpp like that, (3 I think,) so expect to be editing that source a few times.

Before you ask, yes, there should be a new source release. And it should specify which gcc compilers it's appropriate for. Basically, anything 3.0 and above wants the patches; Redhat's 2.96 will work either way, and 2.95 and below want the older source. But I'm not the maintainer.

The funny thing is that if I use the same gcc 3.0 patch and the same steps as above mysql++-1.7.9 compiles without a warning under gcc version 2.96????? And if I apply the gcc 3.2 patch. It will compile under gcc 3.0 with bunches of warnings about things being deprecated.

No, you see, 2.95 did not fully support namespaces. The gcc developers began working on the 3x series, which took a while to get stable. During that time, Redhat was maintaining the 2.9x series code, as it didn't have problems compiling existing code (like the Linux kernel), and developed several enhancements for the 3.x series on the 2.96.x code tree.

As of RH 8.0, they've started shipping gcc-3.2, and I believe stopped supporting gcc-2.96 (called kgcc); their enhancements they've since rolled into the 3.x source tree.

(I'm a Debian user, so I've done my part by understanding what Redhat did. Ask me not about Mandrake, SuSE, Slackware, as I don't know...)