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

getline() error: unexpected token *, expecting , #164

Closed
Neved4 opened this issue Dec 9, 2023 · 0 comments · Fixed by #168
Closed

getline() error: unexpected token *, expecting , #164

Neved4 opened this issue Dec 9, 2023 · 0 comments · Fixed by #168

Comments

@Neved4
Copy link

Neved4 commented Dec 9, 2023

When trying to convert to V using ./c2v on Neved4/twc.c#L85

Code

while ((read = getline(&line, &len, fp)) != -1) {

Output

C to V translator 0.4.0
  translating wcs.c ... wcs.v:4:25: error: unexpected token `*`, expecting `,`
    2 | module main
    3 | 
    4 | fn getline(__linep Char **restrict, __linecapp Size_t *restrict, __stream FILE *restrict) Ssize_t
      |                         ^
    5 | 
    6 | struct Lldiv_t {

Internal vfmt error while formatting file: wcs.v.
Encountered a total of: 1 errors.
 took   121 ms ; output .v file: wcs.v
Translated   1 files in   122 ms.

MWE

Can reproduce with:

#include <stdio.h>
#include <stdlib.h>

int main() {
    char *input = NULL;
    size_t len = 0;
    ssize_t read;

    printf("Enter text (Ctrl+D to quit):\n");

    read = getline(&input, &len, stdin);
    if (read != -1) {
        printf("Entered: %s", input);
        return 0;
    }
    
    printf("error reading input\n");
    free(input);
    return 0;
}
@Neved4 Neved4 changed the title Error when using getline() getline(): error: unexpected token *, expecting , Dec 9, 2023
@Neved4 Neved4 changed the title getline(): error: unexpected token *, expecting , getline(): error: unexpected token *, expecting ,`` Dec 9, 2023
@Neved4 Neved4 changed the title getline(): error: unexpected token *, expecting ,`` getline(): error: unexpected token *, expecting ,` Dec 9, 2023
@Neved4 Neved4 changed the title getline(): error: unexpected token *, expecting ,` getline(): error: unexpected token *, expecting , Dec 9, 2023
@Neved4 Neved4 changed the title getline(): error: unexpected token *, expecting , getline(): error: unexpected token *, expecting , Dec 9, 2023
@Neved4 Neved4 changed the title getline(): error: unexpected token *, expecting , getline() error: unexpected token *, expecting , Dec 9, 2023
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

Successfully merging a pull request may close this issue.

1 participant