flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
baldr
lamar,
In C++ that is impossible. |
|||
![]() |
|
Tyler
Code: int MainFunction(int hWnd,int SomeParam1,int SomeParam2) { return AdditionalFunction(hWnd);//Void functions cannot return stuff, since AdditionalFunction is an int make MainFunction an int. } int AdditionalFunction(int hWnd) { return hWnd+2;//In oreder to use hWnd you need to pass it as a param or declare it in AdditionalFunction. } But for any of them to be used you have to declare them like variables(kinda), you do that like this, Code: int MainFunction(int hWnd,int SomeParam1,int SomeParam2);//Notice the ; int AdditionalFunction(); Also, all the stuff I made comments on being wrong I fixed, look at your original code to find the difference. You should consider learning C first, it's more fun. |
|||
![]() |
|
LocoDelAssembly
Tyler, I think he means the nested function/procedure capabilities Delphi/TurboPascal have.
Code: procedure foo(a: integer) function bar(): integer begin bar := 4 + a; { Notice it can access parameters and variables from its parent } end; begin WriteLn(bar()); end; { bar can't be called from here } The scope part perhaps could be solved by putting the foo and bar in a separate file and make bar static, but the other aspect may not be so easy/safe to emulate and you would have to manually pass the variables/arguments bar requires. |
|||
![]() |
|
TmX
|
|||
![]() |
|
LocoDelAssembly
Quote:
But thank you very much for mentioning it, I didn't know there was support for this. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.