Subject: Re: -Wcast-qual and assignement to strucutres
To: None <tech-kern@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-kern
Date: 02/13/2006 03:55:29
On Mon, Feb 13, 2006 at 01:33:53 +0100, Manuel Bouyer wrote:

> but I know the iovec pointer passed to xs_talkv is read-only. But I
> don't know how to express this in this function.

Use __UNCONST and add a comment why it is safe.


> If I change struct iovec iovec to const, then the compiler complains
> that I'm writing to a read-only member.

Making struct iovec const doesn't make the target type of the iov_base
pointer const, so compiler is right in this case.  You promise to not
modify the structure and you do.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen