From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 7596BBBBB for ; Wed, 29 Mar 2006 11:50:38 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k2T9octo003529 for ; Wed, 29 Mar 2006 11:50:38 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA07744 for ; Wed, 29 Mar 2006 11:50:37 +0200 (MET DST) Received: from mail.tcs.inf.tu-dresden.de (tcs01.inf.tu-dresden.de [141.76.75.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k2T9obwB003526 for ; Wed, 29 Mar 2006 11:50:37 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTP id <0IWV00A9QVC9FL00@mail.tcs.inf.tu-dresden.de> for caml-list@inria.fr; Wed, 29 Mar 2006 11:50:33 +0200 (MEST) Received: from tcs01.inf.tu-dresden.de ([127.0.0.1]) by localhost (mail.tcs.inf.tu-dresden.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04740-08 for ; Wed, 29 Mar 2006 11:50:33 +0200 (MEST) Received: from ithif59.inf.tu-dresden.de (ithif59.inf.tu-dresden.de [141.76.75.59]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTPS id <0IWV009N4VC9TL10@mail.tcs.inf.tu-dresden.de> for caml-list@inria.fr; Wed, 29 Mar 2006 11:50:33 +0200 (MEST) Received: from tews by ithif59.inf.tu-dresden.de with local (Exim 4.50) id 1FOXJx-0002Ex-5z for caml-list@inria.fr; Wed, 29 Mar 2006 11:50:33 +0200 Date: Wed, 29 Mar 2006 11:50:32 +0200 From: Hendrik Tews Subject: scanf %n may return 1 too much? To: caml-list@inria.fr Message-id: <17450.22632.908386.937520@ithif59.inf.tu-dresden.de> MIME-version: 1.0 X-Mailer: VM 7.19 under Emacs 21.4.1 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Virus-Scanned: amavisd-new at tcs.inf.tu-dresden.de X-Miltered: at concorde with ID 442A586E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 442A586D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 scanf:01 scanf:01 sscanf:01 sscanf:01 hendrik:01 tu-dresden:01 exception:01 behaviour:01 precisely:01 int:01 int:01 tcs:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Dear all, is the following really the intented behaviour? # Scanf.sscanf " a" " %n" (fun n -> n);; - : int = 2 # Scanf.sscanf " a" " a%n" (fun n -> n);; - : int = 2 In the first one only one character is consumed, it should IMO return 1. The second one consumes one character more than the first one. So it should return one more than the first one. How can I scan _precisely_ one space without the look ahead behavior that the format " " apparently has? I guessed "% ", but that raises an exception. Bye, Hendrik