On Thu, Jun 20, 2013 at 4:01 PM, Jan Nijtmans <jan.nijtm...@gmail.com>wrote:

> Hm, I would suggest to change the return-type from i64 to size_t. On
> 32-bit systems that would double the maximum number of artifacts,
>

*shiver*

i've had nothing but problems when trying to rely on size_t across
32/64-bit portable apps. i recommend going one further and relying on C99's
<inttypes.h> and <stdint.h>, which define fixed-size integers and their
portable printf/scanf modifiers (as you saw when you patched cson). i use
them in almost all of my code, even projects which are otherwise 100% C89.
There is also a free (BSD) drop-in impl for MS C platforms (since MS
doesn't do C99):
http://code.google.com/p/msinttypes/


The only hassle that needed to be solved first was
> 64-bit support for JSON on win64, but that's done now.
>

Careful - JSON itself does NOT specify integer precision, which means that
just because fossil can now generate e.g. the value 1<<40, doesn't mean
that any given consumer on the other end can read it properly (or even fail
predictably). The IETF is (right now) discussing (at length) a formal JSON
standard and this topic has come up (i've been following the list chatter),
but AFAIK there has been no consensus reached because it is impossible to
enforce any given limits on any and all platforms. They can, at best,
define how a JSON consumer has to deal with values which fall outside of
its limits.


> Richard, Stephan, how do you feel about this?
>

Personally i'm for <inttypes.h> and <stdint.h>, using fixed-size integers,
and i've always been well-served by them, but if 100% portability to c89 is
of a concern then it's not an option. (i tend to aim for c89 but am
relatively ambivalent on the topic.) That said, sqlite3 also uses (long
long) in one of its typedefs, though that type is not strict C89 (but is a
common extension).

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to