Re: [Cbor] Question about draft-ietf-cbor-cddl-08 abnf

Carsten Bormann <cabo@tzi.org> Fri, 17 May 2019 21:11 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 478281200B1; Fri, 17 May 2019 14:11:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id snIoHZLXSmHn; Fri, 17 May 2019 14:11:13 -0700 (PDT)
Received: from smtp.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4D11F12008A; Fri, 17 May 2019 14:11:13 -0700 (PDT)
Received: from [192.168.217.106] (p54A6CC75.dip0.t-ipconnect.de [84.166.204.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.uni-bremen.de (Postfix) with ESMTPSA id 455LYq0p5BzyVc; Fri, 17 May 2019 23:11:11 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CA+mwktJhp6=Opb8G8pBF=64Ye8_oEssOZp1UOgf_MiHoA6R=Yw@mail.gmail.com>
Date: Fri, 17 May 2019 23:11:10 +0200
Cc: draft-ietf-cbor-cddl@ietf.org, cbor@ietf.org
X-Mao-Original-Outgoing-Id: 579820242.0121959-5b872118aff3f054963a4b3f02168873
Content-Transfer-Encoding: quoted-printable
Message-Id: <FB915625-3F59-4FB0-87D2-297DC8C34D45@tzi.org>
References: <CA+mwktJhp6=Opb8G8pBF=64Ye8_oEssOZp1UOgf_MiHoA6R=Yw@mail.gmail.com>
To: Daniel P <danielaparker@gmail.com>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/lDIgsfi8mY1nIM8KDKaKHCyF00k>
Subject: Re: [Cbor] Question about draft-ietf-cbor-cddl-08 abnf
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 17 May 2019 21:11:15 -0000

On May 17, 2019, at 22:37, Daniel P <danielaparker@gmail.com> wrote:
> 
> Regarding
> 
> hexfloat = "0x" 1*HEXDIG ["." 1*HEXDIG] "p" exponent
> 
> should hexfloat allow an optional leading minus sign?

Yes.  

I believe you found a bug.

Would 

hexfloat = [“-"] "0x" 1*HEXDIG ["." 1*HEXDIG] “p" exponent

work for you?

> C/C++ allows that.

Actually, it doesn’t.  

https://en.cppreference.com/w/c/language/integer_constant
has this note:
There are no negative integer constants. Expressions such as -1 apply the unary minus operator to the value represented by the constant, which may involve implicit type conversions.

The same is true for floating point constants.
Both only work if you have a unary minus operator in the language.  
In CDDL, we don’t.  
Copying the C productions is what made us create this bug…

Grüße, Carsten