startup functions

Posted By: Uhrwerk

startup functions - 02/08/13 01:27

I hope I don't inconvenience you... blush
Code:
#include <acknex.h>

void foo_startup_bar()
{
	printf("surprise");
}

Originally Posted By: manual
Functions ending with ..._startup are executed right after the main() function
Posted By: jcl

Re: startup functions - 02/11/13 09:16

Thanks, we'll reword the text.
Posted By: Uhrwerk

Re: startup functions - 02/13/13 00:35

What is to be said against fixing the bug in this case?
Posted By: jcl

Re: startup functions - 02/13/13 11:02

Changing software behavior just to match the documentation could break existing code - therefore we do that only when there's a real reason for it, such as improving or fixing something. In all other cases we change the documentation.
Posted By: Rackscha

Re: startup functions - 02/13/13 15:15

Originally Posted By: jcl
Changing software behavior just to match the documentation could break existing code - therefore we do that only when there's a real reason for it, such as improving or fixing something. In all other cases we change the documentation.


my personal quote of the week^^.

However, if "startup" is registered from everywhere within the identifier, this limits the programmer, as he can not use this word.

AND

in all other places, theses marks occur ONLY at the end of the identifier. For example in shadercode where we use_var, _bmap etc. This behaviour for "startup" doesnt match the general behaviour, is not intended, so it's a bug.
Posted By: Uhrwerk

Re: startup functions - 02/13/13 15:29

Originally Posted By: jcl
Changing software behavior just to match the documentation could break existing code

But that code was already broken in the first place. smirk

Originally Posted By: jcl
therefore we do that only when there's a real reason for it

There is: As Rakscha pointed out the currently implemented behaviour is totally inconsistent with the rest of the software.

Additionally the "_startup" check does not take into account the number of arguments of the function (does not make any sense to me. If it's a startup it shouldn't have any parameters!) This makes the whole thing even more dangerous.
Code:
#include <acknex.h>

void show_startup_text(TEXT* t)
{
	if (t)
		t->flags |= SHOW;
}

This small piece of code will cause your application to crash. Even worse on my machine the crash occurs randomly.
© 2024 lite-C Forums