D - Dernel: dynamic arrays
- =?iso-8859-1?Q?=22Robert_M._M=FCnch=22?= (29/29) Feb 19 2004 Hi, I have the following code, that makes some problems.
- davepermen (3/32) Feb 19 2004 your object is a null reference.. or have you obj = new Obj; somewhere?
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (8/9) Feb 20 2004 Hi, no, because it's a (local) stack object. Or is this not supported?
- Walter (3/8) Jun 23 2004 Class objects are not on the stack; you'll need to new them.
Hi, I have the following code, that makes some problems. This works: char[] str1 = "abc"; k_println(str1); And this part fails: Object obj1; char[] str1; str1 = obj1.toString(); k_println(str1); What's happening at the line with the assignment? The code compiles without any unresoleved reference errors but bombs. This is the ASM output, of the second code snippet. push EBP mov EBP,ESP xor EAX,EAX mov ECX,[EAX] call dword ptr 8[ECX] push EDX push EAX call near ptr _D6kernel7console7printlnFAaZv pop EBP ret What is this "call dword ptr 8[ECX]" thing? Is this a call thru the vtable of the object? It seems, that my stack pointer is wrong. But I don't do anything with it. Maybe that's the problem... -- Robert M. Münch Management & IT Freelancer http://www.robertmuench.de
Feb 19 2004
your object is a null reference.. or have you obj = new Obj; somewhere? "Robert M. Münch" <robert.muench robertmuench.de> schrieb im Newsbeitrag news:opr3lzklwium5vd8 news.digitalmars.com...Hi, I have the following code, that makes some problems. This works: char[] str1 = "abc"; k_println(str1); And this part fails: Object obj1; char[] str1; str1 = obj1.toString(); k_println(str1); What's happening at the line with the assignment? The code compiles without any unresoleved reference errors but bombs. This is the ASM output, of the second code snippet. push EBP mov EBP,ESP xor EAX,EAX mov ECX,[EAX] call dword ptr 8[ECX] push EDX push EAX call near ptr _D6kernel7console7printlnFAaZv pop EBP ret What is this "call dword ptr 8[ECX]" thing? Is this a call thru the vtable of the object? It seems, that my stack pointer is wrong. But I don't do anything with it. Maybe that's the problem... -- Robert M. Münch Management & IT Freelancer http://www.robertmuench.de
Feb 19 2004
On Thu, 19 Feb 2004 15:32:38 +0100, davepermen <davepermen hotmail.com> wrote:your object is a null reference.. or have you obj = new Obj; somewhere?Hi, no, because it's a (local) stack object. Or is this not supported? IIRC this is totaly legal. Robert -- Robert M. Münch Management & IT Freelancer http://www.robertmuench.de
Feb 20 2004
"Robert M. Münch" <robert.muench robertmuench.de> wrote in message news:opr3n2w8yoheztw6 news.digitalmars.com...On Thu, 19 Feb 2004 15:32:38 +0100, davepermen <davepermen hotmail.com> wrote:Class objects are not on the stack; you'll need to new them.your object is a null reference.. or have you obj = new Obj; somewhere?Hi, no, because it's a (local) stack object. Or is this not supported? IIRC this is totaly legal. Robert
Jun 23 2004