RIP
Tutorial
Tags
Topics
Examples
eBooks
Tutorial by Examples
Place allocation and cleanup code next to each other
Scope guards allow executing statements at certain conditions if the current block is left. import core.stdc.stdlib; void main() { int* p = cast(int*)malloc(int.sizeof); scope(exit) free(p); }
Multiple, nested scopes
import std.stdio; void main() { writeln("<html>"); scope(exit) writeln("</html>"); { writeln("\t<head>"); scope(exit) writeln("\t</head>"); "\t\t<title>%s</title>".write...
Page 1 of 1
1
Cookie
This website stores cookies on your computer.
We use cookies to enhance your experience on our website and deliver personalized content.
For more details on our cookie usage, please review our
Cookie Policy
and
Privacy Policy
Accept all Cookies
Leave this website