John:
Sorry, I miss-diagnosed the problem,
the problem cast essentially is:
unsigned long * abc = (void *)(~0UL);
Which means storing a void pointer into a word pointer is illegal.
This should work in both 32 and 64 bit, but fails in both.
curiously, this is legal:
unsigned long * abc = 0;
So go figure.
The code can be re-written as follows:
...
Pvoid_t PValueV; // Judy array element.
LineNumb++; // line number
// store string into array
JHSI(PValueV, PJArray, Index, strlen(Index));
PValue = (PWord_t)PValueV;
...
and will compile 32 and 64 bit with g++ successfully.
Unfortunately, the PValue in Judy can be either a "pointer to a long" or
a "pointer to a pointer to something else". (they are always the same size).
And is decided by the programmer's preference.
In "C" any kind of pointer can be assigned from a void *.
This leaves me with a paradox that I do not have any good ideas on how to fix.
I really don't think it should be illegal storing a void pointer into a long
pointer.
What other use is there for a void pointer? It has no more value than a scaler
such as a long.
Doug Baskins <[EMAIL PROTECTED]>
----- Original Message ----
From: skaller <[EMAIL PROTECTED]>
To: Doug Baskins <[EMAIL PROTECTED]>
Cc: [email protected]; Mike Eynon <[EMAIL PROTECTED]>
Sent: Saturday, July 14, 2007 4:55:13 AM
Subject: Re: CheckDupLines not compiling with gcc
On Fri, 2007-07-13 at 17:07 -0700, Doug Baskins wrote:
> Mike:
>
> I just tried it and found the same thing. The problem is (apparently)
> g++ does not
> allow "casts" except to the value 0.
You mean *from* the value 0.
> Furthermore, I do not know if there
> is a way to cast (-1) or (~0UL) to a void* type.
If void* and int are the same size it is permitted,
but the cast must be explicit.
Judy breaks strict ISO C99 aliasing rules in several places --
I have ignored this. It does matter .. my box is 64 bit,
int isn't long enough to hold a pointer.
you cannot cast
int* <--> char*
for example. If you want to do that you must go *via* a void*.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel