Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native checked functions without arguments #230

Open
wegendt-bosch opened this issue Oct 29, 2018 · 3 comments
Open

Native checked functions without arguments #230

wegendt-bosch opened this issue Oct 29, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@wegendt-bosch
Copy link
Contributor

Currently only checked native functions with at least one argument can be imported, for example

Retcode_T foo(void* unused) {}

We should enable importing checked functions without any arguments, like

Retcode_T bar(void) {}

This would allow easier reuse of library functions.

I propose the following syntax:

native checked fn bar(void): void header "bar.h";
@wegendt-bosch wegendt-bosch added the enhancement New feature or request label Oct 29, 2018
@csweichel
Copy link

Mita's function convention is to have a void* pointer for void functions. The signature Retcode_T bar(void) {} violates this convention and thus cannot be called in checked style. This is intentional.

One can call declare and call void checked functions using native checked fn bar(): void header "bar.h".

@wegendt-bosch
Copy link
Contributor Author

Well, a lot of native Retcode_T-void-functions don't have this though. Sure, it violates our style, but to adhere to it means that users need to write a wrapper for each of those functions, which is cumbersome and feels unneccessary.

I get that this is intentional, however it seems like an ultimately bad intentional decision since it is justified mostly by "it makes the compiler easier".

@wegendt-bosch
Copy link
Contributor Author

Furthermore not even we always adhere to this standard, for example:

Retcode_T SetupTime(void);

Retcode_T EnableTime(void);

Retcode_T EveryHandleEvery10Second1_Enable(void);

and many more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants