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

handle the distinction of Unit and Void in C/C++ code gen #15

Open
feiwang3311 opened this issue Jun 12, 2020 · 0 comments
Open

handle the distinction of Unit and Void in C/C++ code gen #15

feiwang3311 opened this issue Jun 12, 2020 · 0 comments

Comments

@feiwang3311
Copy link
Collaborator

Guannan says:
For my own stuff I have patch for C++:
override def quote(s: Def): String = s match {
case Const(()) => "std::monostate{}";
case _ => super.quote(s)
}
and
override def primitive(t: String): String = t match {
case "Unit" => "std::monostate"
case _ => super.primitive(t)
}
I think we can either 1) pretend Scala Unit is C void, which is the current status 2) or add some macro of Unit in C (eg, define unit value is char 0), 3) or add a Rep[Void] type in Scala/LMS which correspond to C void type (2) requires changes of the generated code (as well as existing projects and tests)(3) requires changes from the scala meta programs

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

No branches or pull requests

1 participant