The Dink Network

c limitations

January 29th 2003, 07:07 AM
anon.gif
Ivan
Ghost They/Them
 
does dink support c-stuff like #include or creating a hheap?
January 29th 2003, 07:35 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
: does dink support c-stuff like #include or creating a hheap?

No, DinkC doesn't support C/C++ stuff, so you can't do those things. You can't even do a for loop, you also can't do complicated math, can't return values and other things like that, so you're limited to simple scripting.
January 29th 2003, 10:43 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
: : does dink support c-stuff like #include or creating a hheap?

: No, DinkC doesn't support C/C++ stuff, so you can't do those things. You can't even do a for loop, you also can't do complicated math, can't return values and other things like that, so you're limited to simple scripting.

The scripting you CAN do does allow you to do almost anything you like in Dink with the exception of some hardcoded stuff. A for loop isn't possible, but you can work around it, naturally.
January 29th 2003, 11:59 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
: The scripting you CAN do does allow you to do almost anything you like in Dink with the exception of some hardcoded stuff.

True, that's why DinkC is a scripting language to create D-Mods, not a massive programming language.

: A for loop isn't possible, but you can work around it, naturally.

Yeah, but other things like complicated math would've been handy

January 31st 2003, 03:39 AM
anon.gif
Ivan
Ghost They/Them
 
But what about declaring pointers to a heap so you can make your own '&story' for example

January 31st 2003, 04:53 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
: But what about declaring pointers to a heap so you can make your own '&story' for example

Well, in DinkC, variables are not reference parameters like in C++. Every variable in DinkC should have an ampersand (& . You can't do something simple like this:

void change(float &x, float &y)

{ float w = x;

x = y;

y = w;

}

That's C++, but int DinkC every variable, global or local, should have an &. To create a local variable in a script, you can do:

int &_a;

Local variables can only be used in that script, globals can be used anywhere. To create a global variable, we usually create them in main.c:

make_global_int("&story", 0);

DinkC is a simple language and many things common in C++ can't be done in DinkC. Also, you can't include other files like .h files, DinkC scriptfiles are .c and they can be compiled to .d but that's not necessary.
January 31st 2003, 11:11 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
: : But what about declaring pointers to a heap so you can make your own '&story' for example

: Well, in DinkC, variables are not reference parameters like in C++. Every variable in DinkC should have an ampersand (& . You can't do something simple like this:

: void change(float &x, float &y)

: { float w = x;

:  x = y;

:  y = w;

: }

: That's C++, but int DinkC every variable, global or local, should have an &. To create a local variable in a script, you can do:

: int &_a;

: Local variables can only be used in that script, globals can be used anywhere. To create a global variable, we usually create them in main.c:

: make_global_int("&story", 0);

: DinkC is a simple language and many things common in C++ can't be done in DinkC. Also, you can't include other files like .h files, DinkC scriptfiles are .c and they can be compiled to .d but that's not necessary.

You can't have unlimited variables, however. You can have about 250 (more or less) globals. You can't go over this number with local variables either, if they're used simultaneously.