Draft
Conversation
Collaborator
|
If I understand correctly it becomes like |
Contributor
Author
Add hundreds of functions? |
Contributor
Author
|
Or just add constdefs? |
Collaborator
|
I don't see how using constants/enums would be better than macros? |
Contributor
Author
|
Some std modules uses this pattern: constdef Foo : inline uint
{
FOO1 = 1,
FOO2 = 2
}
const uint BAR1 = Foo.FOO1;
const uint BAR2 = Foo.FOO2;So, what about this: constdef SysCall : inline uint
{
<* (unsigned int fd, char *buf, size_t count) *>
READ = 0,
<* (unsigned int fd, const char *buf, size_t count) *>
WRITE = 1
etc.
}
<* (unsigned int fd, char *buf, size_t count) *>
const uint SYS_READ = SysCall.READ;
<* (unsigned int fd, const char *buf, size_t count) *>
const uint SYS_WRITE = SysCall.WRITE;
etc. |
Collaborator
|
That doesn't answer why it couldn't be macros? Wouldn't that be nicer? |
Contributor
Author
How useful are hundreds of macros without ported Linux types to C3 types? |
Collaborator
|
You are suggesting: SYS_READ.call(fd, buf, count); With everything untyped. I don't see why one shouldn't do macro sys_read(uint, char* buf, usz count) { ... }It seems like a gross misuse of macros and enums? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'll improve it later for more targets if this PoC is OK.