From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id BC3B57F106 for ; Mon, 18 Jul 2016 11:05:22 +0200 (CEST) IronPort-PHdr: 9a23:mXG4GRGXpITOC9atDQuC551GYnF86YWxBRYc798ds5kLTJ75oM2wAkXT6L1XgUPTWs2DsrQf2rKQ7/GrATJIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWD14LrhqvqpdX6WEZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwuwwZgf8q9tZBXKPmZOx4COUAVHV1e1wyse/mrxTGXEO+738YVX1exgtBBwzC9Dn1W57wtm3xse8riweAOsijB4o1UjSr9asjd1nNzm8lMDg06yuf3tZxh6JzqRSnqgx+ysjTeo7DZ6k2Rb/UYd5PHTkJZc1WTSEUR9rkN4Y= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=Pass smtp.helo=postmaster@annexia.org Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of rich@annexia.org) identity=pra; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of rich@annexia.org designates 80.68.91.176 as permitted sender) identity=mailfrom; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@annexia.org designates 80.68.91.176 as permitted sender) identity=helo; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="postmaster@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CICABcm4xX/7BbRFBcgz9WfIJ2oRAGlG2BeSSFdgKBMToSAQEBAQEBAQFkJ0EOAYFiBAESAYITAQU6PxALGAkTEg8FKCETiDQKvyMBAQEBBgEBAQEeBYViPoRXh2yCLwWZJAGGEohCj0FIj1YkAS+DdDsygXSFSgEBAQ X-IPAS-Result: A0CICABcm4xX/7BbRFBcgz9WfIJ2oRAGlG2BeSSFdgKBMToSAQEBAQEBAQFkJ0EOAYFiBAESAYITAQU6PxALGAkTEg8FKCETiDQKvyMBAQEBBgEBAQEeBYViPoRXh2yCLwWZJAGGEohCj0FIj1YkAS+DdDsygXSFSgEBAQ X-IronPort-AV: E=Sophos;i="5.28,383,1464645600"; d="scan'208";a="226984658" Received: from annexia.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 18 Jul 2016 11:05:00 +0200 Received: from rich by annexia.org with local (Exim 4.84_2) (envelope-from ) id 1bP4Tz-0000J7-NQ; Mon, 18 Jul 2016 10:04:59 +0100 Date: Mon, 18 Jul 2016 10:04:59 +0100 From: "Richard W.M. Jones" To: Jeremy Yallop Cc: Caml List Message-ID: <20160718090459.GD27249@annexia.org> References: <20160718084349.GC27249@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [Caml-list] OCaml max_int and min_int in C On Mon, Jul 18, 2016 at 09:59:40AM +0100, Jeremy Yallop wrote: > On 18 July 2016 at 09:43, Richard W.M. Jones wrote: > > We need to check that an integer being returned from some C bindings > > isn't larger or smaller than Pervasives.max_int / min_int. Are there > > C macros or constants containing these bounds? Obviously we can > > define our own but it seems better to use ones from OCaml if they > > exist. > > There are Max_long and Min_long: > > https://github.com/ocaml/ocaml/blob/ebbe205d/byterun/caml/mlvalues.h#L75-L76 > > Here's an example of Max_long being used to check that the return > value of lseek fits in an OCaml int: > > https://github.com/ocaml/ocaml/blob/ebbe205d/otherlibs/unix/lseek.c#L46-L50 So there is! I was grepping for MAX & INT, not Max and long :-/ Thanks, Rich.