c2v icon indicating copy to clipboard operation
c2v copied to clipboard

`strftime()` error: parameter name must not begin with upper case letter (`Char`)

Open Neved4 opened this issue 2 years ago • 1 comments

When trying to convert to V using ./c2v on Neved4/swc.c#L98

Lines

strftime(timestr, sizeof(timestr), s, localtime(&t));

Output

v wcs.v
wcs.v:16:14: error: parameter name must not begin with upper case letter (`Char`)
   14 | fn localtime( &Time_t) &Tm
   15 | 
   16 | fn strftime( Char *restrict,  usize,  Char *restrict,  Tm *restrict) usize
      |              ~~~~
   17 | 
   18 | fn time( &Time_t) Time_t

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

MWE

Can reproduce with the following:

#include <stdio.h>
#include <time.h>

int main() {
    time_t ctime;
    struct tm *ltime;
    char ftime[100];
    ctime = time(NULL), ltime = localtime(&ctime);
    strftime(ftime, sizeof(ftime), "%Y-%m-%d %H:%M:%S", ltime);
    printf("Current time: %s\n", ftime);
    return 0;
}

Neved4 avatar Dec 09 '23 22:12 Neved4

Related to #164

felipensp avatar Jan 14 '24 00:01 felipensp