C files to V translated successfully but all got plenty of errors when running.

Abierto
#175 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
c

Línea de trabajo

Start with the reported hello_world.c and generated hello_world.v, then reproduce the errors using the listed V, c2v, and GCC versions. Compare the translated output with the terminal errors and the results from the sorting_algorithms and calculate_pi examples. Done means identifying the translation cause and confirming that the affected C examples run without the reported errors.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

There were 3 files I translated, all exhibits similar characteristics: all translated successfully but lots of errors when running the file.
Starting from sorting_algorithms (bubble sort, heap sort, etc)
Then I pull out a simpler C file: calculate_pi
Lastly I tried a hello_world C file --> translated successfully and some errors, but after manual fixing here and there I got it to run.

here is my hello_world.c

#include <stdio.h>

int main(void)
{
    const char lang[] = "C";
    const char object[] = "World";
    printf("Hello, %s %s!\n", lang, object);
    
    return 0;
}

below is the translated hello_world.v

@[translated]
module main

type Size_t = i64
type Ssize_t = i64
type Rsize_t = usize
type Intptr_t = i64
type Uintptr_t = i64
type Ptrdiff_t = i64
type Wchar_t = u16
type Wint_t = u16
type Wctype_t = u16
type Errno_t = int
type Time_t = Time64_t
type pthreadlocinfo = voidptr
type pthreadmbcinfo = voidptr
struct Locale_tstruct { 
	locinfo Pthreadlocinfo
	mbcinfo Pthreadmbcinfo
}
type _locale_t = voidptr
struct LC_ID { 
	wLanguage u16
	wCountry u16
	wCodePage u16
}
type LPLC_ID = voidptr
struct Threadlocinfo { 
	_locale_pctype &u16
	_locale_mb_cur_max int
	_locale_lc_codepage u32
}
struct FILE { 
	_Placeholder voidptr
}
type _off_t = int
type Off32_t = int
type _off64_t = i64
type Off64_t = i64
type Off_t = Off32_t
type Fpos_t = i64
fn main()  {
	lang := c'C'
	object := c'World'
	C.printf(c'Hello, %s %s!\n', lang, object)
	return 
}

below is the error messages I got when trying to run the hello_world.v
WindowsTerminal_I6Mw3cRtxE

as you can see the errors are minor typos...but why these errors appeared in the first place?
I mean in the Youtube demo, you translated the whole DOOM game...why translating just a hello_world script ended up with these errors?

For the other files I just don't bother anymore coz it's a lot and lots of minor errors that needed fixing.
Also looking at there are some open issues relating to the same error...should we expect a fix sometime soon?

V 0.4.4 4145669
C2V latest version
using GCC version 13.2.0 from winlibs

Lenguaje dominante
V
Estrellas
255
Forks
38
Merge medio
1 d 7 h
PR fusionados (30 d)
16

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vlang/c2v

Todos los issues de vlang/c2v

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.