[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: 2nd arg to connect() on Solaris 2.6 not const
From:       Albert Chin <kde-devel () mlists ! thewrittenword ! com>
Date:       2004-12-04 18:37:25
Message-ID: 20041204183725.GB84142 () mail1 ! thewrittenword ! com
[Download RAW message or body]

On Sat, Dec 04, 2004 at 12:35:12PM -0600, Albert Chin wrote:
> On Solaris 2.6/SPARC:
>   $ grep connect /usr/include/sys/socket.h
>   extern int connect(int, struct sockaddr *, int);
> 
> So, in kdelibs-3.3.1/kdecore/network/syssocket.h:
>   inline int kde_connect(int fd, const struct sockaddr* sa, kde_socklen_t len)
>   {
>     return ::connect(fd, sa, len);
>   }
> 
> will generate an error. I already have an autoconf test to determine
> if the 2nd arg to connect() is const or not. How do I cast away the
> const in the return statement to get kde-3.3.1 to build?

Ok, figured it out:
     return ::connect(fd, const_cast<struct sockaddr*>(sa), len);

-- 
albert chin (china@thewrittenword.com)
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic