issue | c | zig (release-safe) | rust (release) | Nim (release) | Nim (danger) | D (@safe) |
---|---|---|---|---|---|---|
out-of-bounds heap read/write | none | runtime | runtime | runtime | none | runtime |
null pointer dereference | none | runtime | runtime | runtime | none | runtime¹ |
type confusion | none | runtime, partial | runtime | compile time | compile time | compile time |
integer overflow | none | runtime | runtime | runtime | none | wraps |
use after free | none | none | compile time | handled by gc | handled by gc | handled by gc or rc |
double free | none | none | compile time | handled by gc | handled by gc | handled by gc or rc |
invalid stack read/write | none | none |
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
/** | |
Bindings for the ALSA sequencer API. | |
See http://alsa-project.org/ for documentation. | |
License: GNU Lesser General Public License version 2.1 | |
Authors: Jaroslav Kysela <perex@perex.cz>, Abramo Bagnara | |
<abramo@alsa-project.org>, and Takashi Iwai <tiwai@suse.de>. | |
D bindings by Paul Backus <snarwin@gmail.com>. |
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
// Mixin to generate a new identifier that won't repeat within a scope | |
enum gensym(string prefix = "_gensym") = | |
`"` ~ prefix ~ `" ~ __traits(identifier, {})["__lambda".length .. $]`; | |
// Works multiple times on the same line | |
unittest | |
{ | |
enum sym1 = mixin(gensym!()); enum sym2 = mixin(gensym!()); | |
static assert(sym1 != sym2); | |
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
/// map over a variadic argument list | |
template mapArgs(alias fun) | |
{ | |
auto mapArgs(Args...)(auto ref Args args) | |
{ | |
import std.typecons: tuple; | |
import core.lifetime: forward; | |
import std.meta: Map = staticMap; | |
auto ref mapArg(alias arg)() |
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
struct Ref(T) | |
{ | |
T* ptr; | |
ref inout(T) deref() inout | |
{ | |
return *ptr; | |
} | |
alias deref this; | |
} |
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
module tail_unqual; | |
import std.traits: isPointer; | |
import std.stdint: uintptr_t; | |
private union HiddenPointer | |
{ | |
// Stores a pointer, cast to an integer. | |
uintptr_t address; |
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
DC = gdc | |
COMPILE.d = $(DC) $(DFLAGS) $(TARGET_ARCH) -c | |
LINK.d = $(DC) $(DFLAGS) $(TARGET_ARCH) | |
.d: | |
$(LINK.d) $^ $(LOADLIBES) $(LDLIBS) -o $@ | |
.d.o: | |
$(COMPILE.d) $(OUTPUT_OPTION) $< |
Field | Value |
---|---|
DIP: | 1035 |
Review Count: | 1 |
Author: | Dennis Korpel dkorpel@gmail.com |
Implementation: | |
Status: | Post-Community 1 |
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
module brainfuck; | |
/// Brainfuck memory | |
struct Memory | |
{ | |
private ubyte[] data; | |
private void extendTo(size_t i) | |
{ | |
if (i >= data.length) data.length = i + 1; |
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
module example; | |
import extension; | |
import lib; | |
// Can extend types from other modules | |
bool empty(A a) { return false; } | |
char front(A a) { return 'a'; } | |
void popFront(A a) {} |
NewerOlder