proc_kill - Functions with different parameters

Posted By: Ch40zzC0d3r

proc_kill - Functions with different parameters - 10/21/13 16:57

Hello laugh
Today I noticed a little bug while using proc_kill.
First of all, heres the code:
Code:
function test(var lol)
{
	while(1)
	{
		DEBUG_VAR(1, 20);
		wait(1);
	}
}

function test(var lol, var tes)
{
	while(1)
	{
		DEBUG_VAR(1, 20);
		wait(1);
	}
}

...

test(1, 5); //test(1);
proc_kill((void*)test);



If Im going to stop test(1) everything works fine, but proc_kill wont stop test(1, 5).
Would be awesome to see a workarround because I know it will take some time till you release the new 3DGS version frown

EDIT: I found a verrrry crappy workarround: Displaying the address and calculate the difference (would be here 0x163)

Code:
proc_kill((void*)(test + 0x163));



This will ONLY stop the second function. Please fix this soon laugh
Posted By: jcl

Re: proc_kill - Functions with different parameters - 10/22/13 08:57

Yes, this workaround is really ugly. For killing overloaded functions you'd need another proc_kill function that takes the number of the overloaded function as a parameter.

Until then, definitely give the functions unique names that you want to kill. This will be added to the manual.
Posted By: Rackscha

Re: proc_kill - Functions with different parameters - 10/22/13 11:36

but isn't there just overloading in parameter-count but in parameter-types too?

something like:

Code:
void Foo(int Arg)
{
...
}

void Foo(float Arg)
{
...
}

Posted By: Uhrwerk

Re: proc_kill - Functions with different parameters - 10/22/13 13:16

Yes, sure. But what's the point of that remark?
Posted By: Feindbild

Re: proc_kill - Functions with different parameters - 10/22/13 13:54

Originally Posted By: Uhrwerk
Yes, sure. But what's the point of that remark?

Because it shows the problem with this approach:
Originally Posted By: jcl
another proc_kill function that takes the number of the overloaded function as a parameter
Posted By: Uhrwerk

Re: proc_kill - Functions with different parameters - 10/22/13 14:53

Sorry, I still don't get it... crazy
Posted By: jcl

Re: proc_kill - Functions with different parameters - 10/22/13 14:59

Me neither, but I guess I need not understand everything laugh.
Posted By: FBL

Re: proc_kill - Functions with different parameters - 10/22/13 16:51

Both functions still have the same number of args and yet are different.
Posted By: WretchedSid

Re: proc_kill - Functions with different parameters - 10/22/13 17:49

Yes, but no one ever said anything about the arguments... Except of Racksha, that is.
Posted By: Uhrwerk

Re: proc_kill - Functions with different parameters - 10/22/13 20:18

Originally Posted By: jcl
For killing overloaded functions you'd need another proc_kill function that takes the number of the overloaded function as a parameter.

jcl, normally I'm needling you to implement features rather than adding advice what no to do in the manual. However, in this specific case it's exactly the opposite for once: please don't implement such a proc_kill function. Such a function will result in extremely hard to maintain and fragile code.
Posted By: FBL

Re: proc_kill - Functions with different parameters - 10/22/13 21:22

Originally Posted By: JustSid
Yes, but no one ever said anything about the arguments... Except of Racksha, that is.


Ah.. I found the problem tongue

"For killing overloaded functions you'd need another proc_kill function that takes the number of the overloaded function as a parameter."

I read that as

" For killing overloaded functions you'd need another proc_kill function that takes the number of the overloaded function parameters."
Posted By: Rackscha

Re: proc_kill - Functions with different parameters - 10/22/13 21:46

ahhhh...yes my bad^^"
Posted By: MasterQ32

Re: proc_kill - Functions with different parameters - 10/22/13 22:21

now the question is: how do we find out which number an overloaded function has.

also i'm not quite sure about the thing with one parameter, but different size. i remember a situation where this didn't work, but this could also be a side effect of the automatic type conversion
Posted By: Uhrwerk

Re: proc_kill - Functions with different parameters - 10/22/13 22:31

Well, if I'm not mistaken you had to count the occurences in the source code. Extremely dangerous to use and immediately breaks once you introduce a new overloaded function.
Posted By: Feindbild

Re: proc_kill - Functions with different parameters - 10/23/13 07:35

Originally Posted By: Firoball
Originally Posted By: JustSid
Yes, but no one ever said anything about the arguments... Except of Racksha, that is.


Ah.. I found the problem tongue


Damn, I made exactly the same mistake and didn't understand why Uhrwerk didn't get what I was saying grin
© 2024 lite-C Forums