source: doc/rob_thesis/examples/variadic/new.c @ 9a9a5c4

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 9a9a5c4 was 9c14ae9, checked in by Rob Schluntz <rschlunt@…>, 5 years ago

add thesis source

  • Property mode set to 100644
File size: 286 bytes
Line 
1forall(dtype T | sized(T)) T * malloc(void);
2
3forall(dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); })
4T * new(Params p) {
5  return ((T*)malloc()){ p }; // construct result of malloc
6}
7
8struct S { int x, y; }; 
9void ?{}(S *, int, int);
10
11int main() {
12  S * s = new(3, 4);
13}
Note: See TracBrowser for help on using the repository browser.