From: Compro P. <com...@gm...> - 2017-05-24 07:41:56
|
typedef unsigned long ULONGLONG; typedef ULONGLONG uint64; typedef uint64 uintP; I think uintP refers to pointer as it is used in definition of "gcv_object_t". But clisp.h doesn't has anything like: build-MT-debug/lispbibl.c:1164: typedef unsigned long long ULONGLONG; Was that overlooked? Or is it not required? |
From: Bruno H. <br...@cl...> - 2017-05-25 12:22:43
|
Compro Prasad wrote: > typedef unsigned long ULONGLONG; > typedef ULONGLONG uint64; > typedef uint64 uintP; > > I think uintP refers to pointer Yes, the comment in lispbibl.d says so. Just search for 'uintP'. > But clisp.h doesn't has anything like: > build-MT-debug/lispbibl.c:1164: typedef unsigned long long ULONGLONG; In my (non-MT) builds, clisp.h contains typedef unsigned long ULONGLONG; ... typedef ULONGLONG uint64; ... typedef uint64 uintP; Bruno |
From: Compro P. <com...@gm...> - 2017-05-26 05:49:29
|
According to what I have seen, 32 bit systems have sizeof(long) as 32 bits and on 64 bit systems it is 64 bits. So, why trust "long". Why not use "int" for 32 bits and "long long" for 64 bits? If there is a problem then what is it? On Thu, May 25, 2017 at 5:52 PM, Bruno Haible <br...@cl...> wrote: > Compro Prasad wrote: >> typedef unsigned long ULONGLONG; >> typedef ULONGLONG uint64; >> typedef uint64 uintP; >> >> I think uintP refers to pointer > > Yes, the comment in lispbibl.d says so. Just search for 'uintP'. > >> But clisp.h doesn't has anything like: >> build-MT-debug/lispbibl.c:1164: typedef unsigned long long ULONGLONG; > > In my (non-MT) builds, clisp.h contains > > typedef unsigned long ULONGLONG; > ... > typedef ULONGLONG uint64; > ... > typedef uint64 uintP; > > Bruno > |
From: Bruno H. <br...@cl...> - 2017-05-26 08:44:05
|
Compro Prasad wrote: > According to what I have seen, 32 bit systems have sizeof(long) as 32 > bits and on 64 bit systems it is 64 bits. On 64-bit native Windows, 'long' is 32 bits, not 64 bits. That is, 'long' can be smaller than a 'void *'. > So, why trust "long". The code trusts the type whose width it has determined. The point of the 'uint32', 'uint64' types is to use *not* make assumptions about the width of a specific type such as 'int' or 'long'. Computer architectures evolve. > Why not use "int" for 32 bits and "long long" for 64 bits? If there is a > problem then what is it? Until recently (2015), you could not use 'long long' portably. Now, finally, MSVC has this type too. Bruno |
From: Daniel J. <dan...@gm...> - 2017-05-26 07:59:28
|
int might also be only 16 bit wide. AFAIK both types also could be larger than 32 respectively 64 bits. The real solution is to use the fixed width integer types provided by the (C99 and newer) standard (int32_t and int64_t). I started work on that in February, but was set back by serious mysterious crashes that appeared even without any of my changes. I'll look whether I can polish the changes to a complete patch next week, that I hopefully can test (assuming CLISP from the repo doesn't crash by itself now). Cheers, Daniel Compro Prasad <com...@gm...> schrieb am Fr., 26. Mai 2017, 07:49: > According to what I have seen, 32 bit systems have sizeof(long) as 32 > bits and on 64 bit systems it is 64 bits. So, why trust "long". Why > not use "int" for 32 bits and "long long" for 64 bits? If there is a > problem then what is it? > > On Thu, May 25, 2017 at 5:52 PM, Bruno Haible <br...@cl...> wrote: > > Compro Prasad wrote: > >> typedef unsigned long ULONGLONG; > >> typedef ULONGLONG uint64; > >> typedef uint64 uintP; > >> > >> I think uintP refers to pointer > > > > Yes, the comment in lispbibl.d says so. Just search for 'uintP'. > > > >> But clisp.h doesn't has anything like: > >> build-MT-debug/lispbibl.c:1164: typedef unsigned long long ULONGLONG; > > > > In my (non-MT) builds, clisp.h contains > > > > typedef unsigned long ULONGLONG; > > ... > > typedef ULONGLONG uint64; > > ... > > typedef uint64 uintP; > > > > Bruno > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > clisp-devel mailing list > cli...@li... > https://lists.sourceforge.net/lists/listinfo/clisp-devel > |
From: Bruno H. <br...@cl...> - 2017-05-26 13:47:01
|
Hi Daniel, > The real solution is to use the fixed width integer types provided by the > (C99 and newer) standard (int32_t and int64_t). ... > > I'll look whether I can polish the changes to a complete patch next week, Will this patch be using gnulib's <stdint.h> replacement that clisp already makes use of? https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html I think the tricky part is to ensure that the generated clisp.h can be used by any compiler that runs on the same platform and produces code for the same ABI. (e.g. on Solaris, "gcc -m64" and "cc -xarch=generic64"). Bruno |