2 registered members (VoroneTZ, TipmyPip),
1,333
guests, and 0
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Gamestudio 8.47
[Re: Superku]
#458395
03/07/16 22:37
03/07/16 22:37
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
I really don't like that thing of not writing type information but AFAIK all parameters without type are expected to be/ treated as var, as well as the "function" keyword itself (or is it void?). So that should be fine I guess. function is an alias for var, so the return type is there. Anyway, not declaring a type is something that was legal in K&R C and up to C89, looked something like this: It's no longer valid since C99, for very obvious and good reasons. You can ommit the name though, and write something like "void foo(int, char*)". BSD is infamous for having type signatures like that. Imho everyone who is into the UNIX philosophy of using the least amount of characters to write a function declaration should be stoned, but nobody is asking me who should be stoned anymore these days (but seriously, who is expected to understand "void strncat(char*,const char*, size_t)" without looking it up?!) So yeah, no, not legal. However, since we are at the topic of C quirkiness, anyone want to take a guess what the difference between these two is?
void foo();
void bar(void);
Answer: The first one will accept ANY argument, you can call it with as many arbitrary arguments you want. The second one doesn't accept any. C++ did away with that insanity, also for good and obvious reasons.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Gamestudio 8.47
[Re: WretchedSid]
#458400
03/08/16 08:10
03/08/16 08:10
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
Serious User
|
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
I really don't like that thing of not writing type information but AFAIK all parameters without type are expected to be/ treated as var, as well as the "function" keyword itself (or is it void?). So that should be fine I guess. function is an alias for var, so the return type is there. Anyway, not declaring a type is something that was legal in K&R C and up to C89, looked something like this: It's no longer valid since C99, for very obvious and good reasons. You can ommit the name though, and write something like "void foo(int, char*)". BSD is infamous for having type signatures like that. Imho everyone who is into the UNIX philosophy of using the least amount of characters to write a function declaration should be stoned, but nobody is asking me who should be stoned anymore these days (but seriously, who is expected to understand "void strncat(char*,const char*, size_t)" without looking it up?!) So yeah, no, not legal. However, since we are at the topic of C quirkiness, anyone want to take a guess what the difference between these two is?
void foo();
void bar(void);
Answer: The first one will accept ANY argument, you can call it with as many arbitrary arguments you want. The second one doesn't accept any. C++ did away with that insanity, also for good and obvious reasons.
I use this plugin with this kind of function prototypes since 2008 without any problem ... until now. So there must have been a change with this version or accessing external plugins via dll isn't possible with an open beta version at all?
|
|
|
Re: Gamestudio 8.47
[Re: pegamode]
#458419
03/08/16 20:59
03/08/16 20:59
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
I use this plugin with this kind of function prototypes since 2008 without any problem ... until now. So there must have been a change with this version or accessing external plugins via dll isn't possible with an open beta version at all?
I was mostly trying to say why the code shouldn't have compiled in the first place. If I may ask, why don't you provide type information? The type will default to int, which may or may not be the size of a pointer (most likely it will be on a 32 bit system), but the type int is only guaranteed to be at least 2 bytes. Same with using function, var is not really a type meant for holding pointers. Just because everyone does it, doesn't meant everyone should!
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Gamestudio 8.47
[Re: WretchedSid]
#458423
03/09/16 08:16
03/09/16 08:16
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
Serious User
|
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
I use this plugin with this kind of function prototypes since 2008 without any problem ... until now. So there must have been a change with this version or accessing external plugins via dll isn't possible with an open beta version at all?
I was mostly trying to say why the code shouldn't have compiled in the first place. If I may ask, why don't you provide type information? The type will default to int, which may or may not be the size of a pointer (most likely it will be on a 32 bit system), but the type int is only guaranteed to be at least 2 bytes. Same with using function, var is not really a type meant for holding pointers. Just because everyone does it, doesn't meant everyone should! I guess the reason was the example in the manual:
Using the DLL in C-Script and lite-C
...
In lite-C it's just a normal prototype (and you can use other variable types than var), in C-Script we need a special dllfunction declaration:
dllfunction ldexpc(x,n); // declaration of a DLL function in C-Script function ldexpc(x,n); // declaration of a DLL function in lite-C
I also assumed that the default type is var not int.
|
|
|
|