Re: CVS commit: src/sys/sys

2009-08-09 Thread Tonnerre LOMBARD
Salut,

On Mon, Aug 10, 2009 at 12:24:47AM +0200, Martin Husemann wrote:
> On Sun, Aug 09, 2009 at 09:20:02PM +, Christos Zoulas wrote:
> > The new style casts are very useful because they show programming intent.
> 
> Yes, new style casts are fine.
> 
> But warning about old style casts in a language that is designed to be C
> compatible is plain stupid.

Not really; there should be the choice of warning about them where
appropriate. If we have C style casts in system header files, the
likelyhood of having them included at the time we want to warn
about C style casts is quite high. This would then break code compiled
with -Werror, which is completely unnecessary and IMO wrong.

> Besides, there should be no casts in system headers ;-}

That maybe too.

Tonnerre


pgpF4BjmNjG3u.pgp
Description: PGP signature


Re: CVS commit: src/sys/sys

2009-08-09 Thread Martin Husemann
On Sun, Aug 09, 2009 at 09:20:02PM +, Christos Zoulas wrote:
> The new style casts are very useful because they show programming intent.

Yes, new style casts are fine.

But warning about old style casts in a language that is designed to be C
compatible is plain stupid.

Besides, there should be no casts in system headers ;-}

Martin


Re: CVS commit: src/sys/sys

2009-08-09 Thread Christos Zoulas
In article <20090809210918.gc22...@drowsy.duskware.de>,
Martin Husemann   wrote:
>On Sun, Aug 09, 2009 at 09:29:50PM +0200, Tonnerre LOMBARD wrote:
>> Unfortunately, these are widely used headers. We don't want to break
>> -Wold-style-casts in general.
>
>Why not?
>
>It is IMHO a very useless and stupid warning.

The new style casts are very useful because they show programming intent.

christos



Re: CVS commit: src/sys/sys

2009-08-09 Thread Tonnerre LOMBARD
Salut,

On Sun, Aug 09, 2009 at 11:09:18PM +0200, Martin Husemann wrote:
> On Sun, Aug 09, 2009 at 09:29:50PM +0200, Tonnerre LOMBARD wrote:
> > Unfortunately, these are widely used headers. We don't want to break
> > -Wold-style-casts in general.
> 
> Why not?
> 
> It is IMHO a very useless and stupid warning.

Old style casts in C++ are deprecated and should not be used; it is
also a question if they're always going to work right. Additionally,
they are deprecated because they disable some sanity checks etc.

There may be valid reasons not to want to have them.

Tonnerre


pgpXHomRJRure.pgp
Description: PGP signature


Re: CVS commit: src/sys/sys

2009-08-09 Thread Martin Husemann
On Sun, Aug 09, 2009 at 09:29:50PM +0200, Tonnerre LOMBARD wrote:
> Unfortunately, these are widely used headers. We don't want to break
> -Wold-style-casts in general.

Why not?

It is IMHO a very useless and stupid warning.

Martin
(wering his C++ programmer hat)


Re: CVS commit: src/sys/sys

2009-08-09 Thread Christos Zoulas
In article <20090809191929.gc3...@snowdrop.l8s.co.uk>,
David Laight   wrote:
>On Sat, Aug 08, 2009 at 05:23:15PM -0400, Christos Zoulas wrote:
>> Module Name: src
>> Committed By:christos
>> Date:Sat Aug  8 21:23:15 UTC 2009
>> 
>> Modified Files:
>>  src/sys/sys: bswap.h cdefs.h endian.h termios.h
>> 
>> Log Message:
>> Create and use __CAST(type, value) in headers so that modern c++ with
>> -Wold-style-casts does not bitch.
>
>Do we really have to do that, it starts making files completely unreadable.

The alternative is to use __CAST(type), but then we need to be careful
so that the next value is parenthesized in c++. I don't think that it is
preferable.

christos



Re: CVS commit: src/sys/sys

2009-08-09 Thread Tonnerre LOMBARD
Salut,

On Sun, Aug 09, 2009 at 08:19:29PM +0100, David Laight wrote:
> > Modified Files:
> > src/sys/sys: bswap.h cdefs.h endian.h termios.h
> > 
> > Log Message:
> > Create and use __CAST(type, value) in headers so that modern c++ with
> > -Wold-style-casts does not bitch.
> 
> Do we really have to do that, it starts making files completely unreadable.

Unfortunately, these are widely used headers. We don't want to break
-Wold-style-casts in general.

Tonnerre


pgptwrI1zQcA1.pgp
Description: PGP signature


Re: CVS commit: src/sys/sys

2009-08-09 Thread David Laight
On Sat, Aug 08, 2009 at 05:23:15PM -0400, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Sat Aug  8 21:23:15 UTC 2009
> 
> Modified Files:
>   src/sys/sys: bswap.h cdefs.h endian.h termios.h
> 
> Log Message:
> Create and use __CAST(type, value) in headers so that modern c++ with
> -Wold-style-casts does not bitch.

Do we really have to do that, it starts making files completely unreadable.

David

-- 
David Laight: da...@l8s.co.uk