X-Spam-Check-By: sourceware.org
Date: Fri, 21 Apr 2006 14:27:40 +0200
To: cygwin@cygwin.com
Subject: Re: htonl, htons, ntohl and ntohs types
Message-ID: <20060421122740.GA16326@tuxedo.skovlyporten.dk>
References: <20060421092508.GA15855@tuxedo.skovlyporten.dk> <20060421100000.GC12661@calimero.vinschen.de> <20060421121151.GA16022@tuxedo.skovlyporten.dk> <20060421121713.GB4189@implementation>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20060421121713.GB4189@implementation>
User-Agent: Mutt/1.5.11+cvs20060403
From: lars@segv.dk (Lars Munch)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Fri, Apr 21, 2006 at 02:17:13PM +0200, Samuel Thibault wrote:
> Lars Munch, le Fri 21 Apr 2006 14:11:51 +0200, a écrit :
> > On Fri, Apr 21, 2006 at 12:00:00PM +0200, Corinna Vinschen wrote:
> > > On Apr 21 11:25, Lars Munch wrote:
> > > > Hello
> > > > 
> > > > I have noticed that the types of the functions htonl, htons, ntohs and
> > > > ntohl differs from standard (and linux):
> > > > 
> > > > http://www.opengroup.org/onlinepubs/000095399/functions/htonl.html
> > > > 
> > > > Cygwin uses:
> > > > 
> > > > unsigned long int        ntohl(unsigned long int);
> > > > unsigned short int       ntohs(unsigned short int);
> > > > unsigned long int        htonl(unsigned long int);
> > > > unsigned short int       htons(unsigned short int);
> > > > 
> > > > The standard (and Linux) has:
> > > > 
> > > > uint32_t htonl(uint32_t hostlong);
> > > > uint16_t htons(uint16_t hostshort);
> > > > uint32_t ntohl(uint32_t netlong);
> > > > uint16_t ntohs(uint16_t netshort);
> > > > 
> > > > Is there any reason for this difference?
> > > 
> > > Nobody had a problem so far?
> > > 
> > > Fixed in CVS.
> > 
> > Wow, that was fast. Thanks!
> > 
> > My code still gives me warnings due to a problem with stdint.h.
> > 
> > The Xint32_t typedef's uses long instead of int:
> 
> That's on purpose: on windows, ints are 16bits.

How can that be when sizeof(int) returns 4 with cygwin gcc on a 32bit
windows?

Regards
-- Lars Munch

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

