-
Notifications
You must be signed in to change notification settings - Fork 67
Revise and expand on C/C++ language support section #298
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
base: main
Are you sure you want to change the base?
Changes from all commits
5610021
6d68e09
df8a045
d47c634
1140922
b28929a
ac98c1a
0cf108d
09e2c4f
014a58c
dbbf191
3be8a7e
42746b9
c02e274
8bbe5bd
62ab88e
7e553ee
b6a4b0b
fc58b33
c77a855
069313a
58215c5
1869fcf
ac9f43b
08f6720
b93f7d4
d6737d5
e25ffd7
363e7c9
5bceb22
dc7a784
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "adder.h" | ||
|
||
uint32_t exports_docs_adder_add_add(uint32_t x, uint32_t y) | ||
{ | ||
return x + y; | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,9 @@ | ||||
#include "adder.h" | ||||
#include <stdio.h> | ||||
|
||||
uint32_t exports_docs_adder_add_add(uint32_t x, uint32_t y) | ||||
{ | ||||
uint32_t result = x + y; | ||||
printf("%d", result); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We can probably get rid of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the point of including the example that uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh thank you sorry I lost this context. This would be fine as-is, but what do you think about adding a comment here? Above the I'm thinking of a note like: // On traditional platforms, printf() prints to stdout, but on Wasm platforms
// stdout and the idea of printing to output stream is introduced and managed by
// WASI.
//
// When building this code with wasi-libc (as a part of wasi-sdk), the printf call
// below is replaced with code that uses `wasi:cli/stdout` and `wasi:io/streams`. |
||||
return result; | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've quite intentionally avoided putting other tutorial examples inside this codebase, but I'm thinking we should reconsider that. I'd personally like to see all code we put in the language guides hosted in component-docs so we can at least test them via CI.
That said, this has come up and we decided against it -- maybe I'm misremembering.
Thoughts @itowlson , @kate-goldenring ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was my thought -- that if the code examples were in separate files, they could eventually be tested in CI.