Skip to Content.
Sympa Menu

freetds - Re: [freetds] patch to fix -Wold-style-cast in headers

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] patch to fix -Wold-style-cast in headers
  • Date: Mon, 9 May 2005 22:37:56 -0400

On May 9, 10:32pm, jklowden AT freetds.org ("James K. Lowden") wrote:
-- Subject: Re: [freetds] patch to fix -Wold-style-cast in headers

| Christos, first off, thanks for your patch. I'll use TDS_STATIC_CAST if
| our discussion doesn't yield something better.
|
| Inventing our own answer to something that's being solved time and time
| again all over the Internet rubs me the wrong way. Isn't there some
| generally accepted practice on this score? FreeTDS can hardly be the
| first project to encounter it. (I didn't find one on Google....)
|
| I see NetBSD adopted __static_cast() perhaps based on pr lib/11766 back in
| December 2000. Why not something like:

I did not even know that NetBSD had it! Blush!

| #ifndef __static_cast
| # define STATIC_CAST_DEFINED_HERE_BY_FREETDS
| # ifdef __cplusplus
| # define __static_cast(type,y) static_cast<type>(y)
| # else
| # define __static_cast(type,a) ((type)(a))
| # endif
| #endif
|
| [and at the end of the file]
|
| #ifdef STATIC_CAST_DEFINED_HERE_BY_FREETDS
| # undef STATIC_CAST_DEFINED_HERE_BY_FREETDS
| # undef __static_cast
| #endif
|
| I grant that __static_cast might exist for some other purpose, but Google
| doesn't find anything about it except for NetBSD. And there's no
| guarantee that TDS_STATIC_CAST isn't already in use at Tri-Data Systems,
| Inc. Seems like an experiment worth trying.
|

Sure that looks to me like the best way to deal with it. I doubt
that undefining is necessary...

christos




Archive powered by MHonArc 2.6.24.

Top of Page