1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v2: consts, $if, attributes, globals, if/for type check, prefs

This commit is contained in:
Alexander Medvednikov
2020-02-03 07:02:54 +01:00
parent 7808f4c272
commit d87cb3f672
11 changed files with 433 additions and 159 deletions

View File

@ -81,10 +81,10 @@ pub fn eprintln(s string) {
panic('eprintln(NIL)')
}
$if !windows {
C.fflush(stdout)
C.fflush(stderr)
C.fprintf(stderr, '%.*s\n', s.len, s.str)
C.fflush(stderr)
C.fflush(C.stdout)
C.fflush(C.stderr)
C.fprintf(C.stderr, '%.*s\n', s.len, s.str)
C.fflush(C.stderr)
return
}
// TODO issues with stderr and cross compiling for Linux
@ -96,10 +96,10 @@ pub fn eprint(s string) {
panic('eprint(NIL)')
}
$if !windows {
C.fflush(stdout)
C.fflush(stderr)
C.fprintf(stderr, '%.*s', s.len, s.str)
C.fflush(stderr)
C.fflush(C.stdout)
C.fflush(C.stderr)
C.fprintf(C.stderr, '%.*s', s.len, s.str)
C.fflush(C.stderr)
return
}
print(s)
@ -124,6 +124,8 @@ pub fn print(s string) {
__global total_m i64=0
__global nr_mallocs int=0
fn looo(){} // TODO remove, [ pratt
[unsafe_fn]
pub fn malloc(n int) byteptr {
if n <= 0 {