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: "James K. Lowden" <jklowden AT freetds.org>
  • 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:32:28 -0400

Christos Zoulas wrote:
> On May 9, 1:54pm, entropy AT freetds.org (entropy AT freetds.org) wrote:
> -- Subject: Re: [freetds] patch to fix -Wold-style-cast in headers
>
>
> | OK, but I think it should be TDS_STATIC_CAST to avoid random namespace
> |
> | pollution in user programs.
>
> Sure, sounds fine to me.

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:

#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.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page