From owner-freebsd-hackers Fri Aug 21 19:59:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA14525 for freebsd-hackers-outgoing; Fri, 21 Aug 1998 19:59:16 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from redfish.go2net.com (redfish.go2net.com [207.178.55.5]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id TAA14518 for ; Fri, 21 Aug 1998 19:59:12 -0700 (PDT) (envelope-from marcs@go2net.com) Received: from marcs by redfish.go2net.com with smtp (Exim 1.82 #2) id 0zA3s2-0000Ja-00; Fri, 21 Aug 1998 19:57:38 -0700 Date: Fri, 21 Aug 1998 19:57:38 -0700 (PDT) From: Marc Slemko X-Sender: marcs@redfish To: Phil Gilley cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Stupidity or compiler bug? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 21 Aug 1998, Phil Gilley wrote: > Am I doing something really stupid here or is this a compiler bug? > The output of this program under 2.2.7-RELEASE is "1.2.3.4 1.2.3.4" > which isn't what I was expecting. "1.2.3.4 5.6.7.8" is what I was > hoping for. [...] > > iph.ip_src.s_addr = ntohl(0x01020304); > iph.ip_dst.s_addr = ntohl(0x05060708); > > printf("%s %s\n", inet_ntoa(iph.ip_src), inet_ntoa(iph.ip_dst)); inet_ntoa uses static memory, so you can't call it multiple times without doing something with the result in between calls. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message