You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a C file that includes a function with the prototype int main(int argc, char **argv), V produces incorrect code referencing e.g. the argv array, but this array itself is nowhere to be found, so the generated V code does not compile
$ cat argv.c#include <stdio.h>int main(int argc, char **argv) { for (int i = 0; i < argc; i++) { puts(argv[i]); } return 0;}
$ v translate argv.cC to V translator 0.4.0 translating /home/justinas/vlang-testcases/argv.c ... Reformatted file: /home/justinas/vlang-testcases/argv.v took 100 ms ; output .v file: argv.vTranslated 1 files in 100 ms.
$ cat argv.v@[translated]module mainfn main() { for i := 0; i < argc; i++ { C.puts(argv[i]) } return}
$ v run argv.vargv.v:5:18: error: undefined ident: `argc` 3 | 4 | fn main() { 5 | for i := 0; i < argc; i++ { | ~~~~ 6 | C.puts(argv[i]) 7 | }argv.v:6:10: error: undefined ident: `argv` 4 | fn main() { 5 | for i := 0; i < argc; i++ { 6 | C.puts(argv[i]) | ~~~~ 7 | } 8 | returnargv.v:6:14: error: type `void` does not support indexing 4 | fn main() { 5 | for i := 0; i < argc; i++ { 6 | C.puts(argv[i]) | ~~~ 7 | } 8 | returnargv.v:6:10: error: `argv[i]` (no value) used as value in argument 1 to `C.puts` 4 | fn main() { 5 | for i := 0; i < argc; i++ { 6 | C.puts(argv[i]) | ~~~~~~~ 7 | } 8 | return
The text was updated successfully, but these errors were encountered:
Given a C file that includes a function with the prototype
int main(int argc, char **argv)
, V produces incorrect code referencing e.g. theargv
array, but this array itself is nowhere to be found, so the generated V code does not compileThe text was updated successfully, but these errors were encountered: