Weird array problems

Started by
13 comments, last by Splat 24 years, 5 months ago
Yes, you can.

However, I think that in a few years we'll be in a situation where we'll see bytecode that out performs precompiled code.

The reason is simple: Bytecode can be optimized on-the-fly to fit the exact architecture of the machine it is running on (I.e. Anything from processor, memory size and cache to bus speed and various addon hardware (DSP, GPU etc.) can be considered during optimization - something you can't do in precompilation, unless you want 5000 different executables)

And because of the extremely strict rules that the bytecode adhere to, it is much easier to optimize than e.g. C++.

SUN's hotspot compiler is the first preview of the capabilities of this awesome technology!

/Niels

<b>/NJ</b>
Advertisement
That will certainly be cool. However, my reason for wanting to be able to create Java executables is more for esae of use and install:

I don't want to have to install a Java interpreter and then run my program through the interpreter. I'd rather just be able to click on an EXE file and it will start up.

I'm not sure about the size of the bytecode interpreter, but what might be cool is to in the future attach the interpreter to the bytecode in such a way that basically running the EXE runs the interpreter to load the attached bytecode and run it.

Enough blabbering.

- Splat

Since you talk .exe's I assume you are targeting the windows platform - Any windows platform with IE (or NS for that matter) installed WILL also have the Java run-time installed (Unless they went through a lot of trouble to get rid of it ).

If you want to get a better idea of whats possible in pure Java today, check out demos such as "forward" (I think it's by "komplex" or something like that, might be wrong tho')...

Their new stuff is at (haven't seen it yet):

ftp://ftp.scene.org/pub/incoming/ASSEMBLY99/java/

/Niels

<b>/NJ</b>
Ok, this has been bugging me for a while and I'm pretty sure it's Visual C++ screwing up but here it goes:

I have a class defined as follows:

class ... {
public:
....
private:
struct ... myStructs[100];
}

Ok, now, I initialize the variables in another function.

void ...::Initialize() {
int i;
for (i = 0; i <= 100; i++) {
myStructs.member1 = 0;<BR> myStructs.member2 = 0;<BR> }<BR>}<P>Ok, here's where it really screws up: When the program quits, it tells me "HEAP[GameTest.exe]: Heap block at 008C6F20 modified at 008C7558 past requested size of 630"<P>Now, I've found 2 ways to fix this: One is to increase the array size by 1, and NEVER touch that last entry. The second is to not touch the "member2" member of the structure. Either one will avoid the heap overflow.<P>I have encountered variations of this problem before in Visual C++. Even without structures, with simple int arrays. <P>WTF is going on?!?!?!?! Is Visual C++ not allocating enough space for scoped arrays??<P>I can avoid it for now with the additional element at the end of the array, but I would REALLY REALLY REALLY like to know why this is happening to me.<P>- Splat<p>[This message has been edited by Splat (edited October 26, 1999).]

This is a reply to an earlier question from Splat. The latest version of the GNU C/C++ compiler (version 2.95) comes with a Java compiler that can generate native code for a lot of platforms, including Windows. And its free! I've looked at the code it generates and its quite good. That was for an ARM processor mind you!

Lastly, anyone interested in fast Java VMs should check out Sun's Hotspot VM. It figures out which part of your code should be compiled and which should be interpreted at runtime.

This topic is closed to new replies.

Advertisement