Commit Graph

9 Commits

Author SHA1 Message Date
Andrew Kelley
6dba1f1c8e slice and array re-work plus some misc. changes
* `@truncate` builtin allows casting to the same size integer.
   It also performs two's complement casting between signed and
   unsigned integers.
 * The idiomatic way to convert between bytes and numbers is now
   `mem.readInt` and `mem.writeInt` instead of an unsafe cast.
   It works at compile time, is safer, and looks cleaner.
 * Implicitly casting an array to a slice is allowed only if the
   slice is const.
 * Constant pointer values know if their memory is from a compile-
   time constant value or a compile-time variable.
 * Cast from [N]u8 to []T no longer allowed, but [N]u8 to []const T
   still allowed.
 * Fix inability to pass a mutable pointer to comptime variable at
   compile-time to a function and have the function modify the
   memory pointed to by the pointer.
 * Add the `comptime T: type` parameter back to mem.eql. Prevents
   accidentally creating instantiations for arrays.
2017-02-12 17:35:51 -05:00
Andrew Kelley
8a859afd58 std.io supports printing integers as hex values
remove "unnecessary if statement" error
this "depends on compile variable" code is too hard to validate,
and has false negatives. not worth it right now.

std.str removed, instead use std.mem.

std.mem.eql and std.mem.sliceEql merged and do not require explicit
type argument.
2017-02-07 17:23:50 -05:00
Andrew Kelley
0b34439c1f mem.free no longer requires explicit type argument 2017-01-23 00:11:21 -05:00
Andrew Kelley
69132bdeda IR: progress toward compiling standard library
* comptime fn call
 * is_comptime doesn't count as an instruction dependency
 * update more std code to latest zig
2016-12-31 17:10:29 -05:00
Andrew Kelley
b55efe5fab update more std library to new zig 2016-12-21 23:34:14 -05:00
Andrew Kelley
82101198f1 workaround for Arch being a primitive type 2016-12-18 20:09:34 -05:00
Andrew Kelley
a71fbe49cb IR: add FnProto instruction 2016-12-18 19:40:26 -05:00
Andrew Kelley
320e26590a fix std io input to work for non seekable fds 2016-08-31 20:23:47 -07:00
Andrew Kelley
ed50bd1b65 progress toward stack trace printing 2016-08-17 20:11:04 -07:00