From owner-freebsd-hackers Mon Jun 9 08:25:29 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id IAA27477 for hackers-outgoing; Mon, 9 Jun 1997 08:25:29 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id IAA27471 for ; Mon, 9 Jun 1997 08:25:25 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id AAA29286; Tue, 10 Jun 1997 00:55:22 +0930 (CST) From: Michael Smith Message-Id: <199706091525.AAA29286@genesis.atrad.adelaide.edu.au> Subject: Re: %i conversion in sscanf? In-Reply-To: <199706091452.AAA29091@genesis.atrad.adelaide.edu.au> from Michael Smith at "Jun 10, 97 00:22:20 am" To: msmith@atrad.adelaide.edu.au (Michael Smith) Date: Tue, 10 Jun 1997 00:55:22 +0930 (CST) Cc: hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Michael Smith stands accused of saying: > > It's "fairly" clear that %i might be expected to convert 0xABCDEF45 > to a negative number - Tcl thinks that way : > > silver:/tmp>tclsh > % expr 0xABCDEF45 > -1412567227 Oops, take that back one level. Tcl does _not_ think it's a good idea, it appears to think the same way as sscanf (because it uses it, dummy) silver:/tmp>tclsh % scan 0xABCDEF45 "%i" foo 1 % puts $foo 2147483647 % format "%x" $foo 7fffffff -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[