This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Value is a template that represents a class object value. This is in contrast to a | |
normal class object which is a pointer to a class object value. | |
--- | |
void foo(Value!SomeClass value) | |
{ | |
// ... use value | |
} | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Script to update json test files | |
set -x | |
make test_results/compilable/json2.d.out | |
cp test_results/compilable/json2.out.sanitized compilable/extra-files/json2.out | |
make test_results/compilable/jsonCompilerInfo.d.out | |
cp test_results/compilable/jsonCompilerInfo.out.sanitized compilable/extra-files/jsonCompilerInfo.out | |
make test_results/compilable/json_nosource.sh.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
int a = 42; | |
import std.stdio; | |
import std.conv : text; | |
// | |
// Want to create the string "a is 42" | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
int a = 42; | |
import std.stdio; | |
import std.conv : text; | |
// | |
// Want to create the string "a is 42" | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub fn copyVarargs(array: var, args: ...) void { | |
comptime var i = 0; | |
inline while (i < args.len) : (i += 1) array[i] = args[i]; | |
} | |
pub fn allocVarargs(comptime T: type, allocator: *std.mem.Allocator, args: ...) ![]T { | |
var array = try allocator.alloc(T, args.len); | |
copyVarargs(array, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUMMARY = "Call openssl-wrapper" | |
DESCRIPTION = "${SUMMARY}" | |
LICENSE = "CLOSED" | |
DEPENDS += "openssl-wrapper-native" | |
do_configure() { | |
openssl-wrapper | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run with: zig run --library c test.zig | |
const std = @import("std"); | |
extern "C" fn strlen([*:0]const u8) c_int; | |
pub fn main() void { | |
std.debug.warn("strlen(\"abc\") = {}\n", strlen("abc")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const Allocator = struct { | |
pub const Error = error{OutOfMemory}; | |
allocFn: fn (self: *Allocator, len: usize) Error![]u8, | |
freeFn: fn(self: *Allocator, ptr: []u8) void, | |
// DOWNSIDE: we have to generate these that handle passing the self ptr | |
// by hand for every interface | |
pub fn alloc(self: *Allocator, len: usize) Error![]u8 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const Allocator = std.mem.Allocator; | |
const ArrayList = std.ArrayList; | |
const Mutex = std.Mutex; | |
const Thread = std.Thread; | |
fn log(comptime fmt: []const u8, args: anytype) void { | |
std.debug.warn(fmt ++ "\n", args); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Segmentation fault at address 0x7f584e9e1018 | |
/home/marler8997/tmp/zig-scheduler/thread_pool.zig:63:29: 0x234e1c in RunQueue.push (thread_pool) | |
tail.next = runnable; | |
^ | |
/home/marler8997/tmp/zig-scheduler/thread_pool.zig:209:32: 0x236978 in ThreadPool.schedule (thread_pool) | |
self.run_queue.push(runnable); | |
^ | |
/home/marler8997/tmp/zig-scheduler/thread_pool.zig:198:22: 0x2342ba in ThreadPool.spawn (thread_pool) | |
self.schedule(&wrapper.runnable); | |
^ |
OlderNewer