classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classpath build process and VM-specific issues


From: Andrew Haley
Subject: Re: Classpath build process and VM-specific issues
Date: Mon, 5 Apr 2004 21:53:59 +0100

Archie Cobbs writes:
 > Andrew Haley wrote:
 > >  > Prove me wrong with a specific ISO C specification clause, if you
 > >  > claim otherwise.
 > > 
 > > I spent a long time working on and supporting gcc, and this is the
 > > rule I've had to refer people to more times than any other.  It's
 > > amazing how many programmers don't know the specfication.
 > 
 > You guys are going off into the weeds. All that's required from C
 > for the byte[] strategy to work is that this works:
 > 
 >    void *ptr;
 >    char *buf;
 > 
 >    ptr = <any valid pointer value>
 >    buf = malloc(sizeof(ptr));
 >    memcpy(buf, &ptr, sizeof(ptr));
 > 
 >    ... then sometime later ...
 > 
 >    memcpy(&ptr, buf, sizeof(ptr));
 >    <continue using the fully restored ptr>
 > 
 > I'm not a specophile but I would guess that C does at least guarantee this.

It does.  I'm not trying to get into a debate about micro-
optimization: given the overhead of JNI, it's probably not important.
What I care about is that the code should be legal, maintainable, and
efficient -- in that order.

Having spent a lot of time working on SWT, the ability to subclass a
native pointer is IMO very important indeed.  It would have saved me a
huge amount of time if native pointers had types.  This is more
important than quibbles about efficiency.

However, if someone posts code that I don't believe is legal, I will
point it out.  I mean, I can't help it.  :-)

Andrew.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]