allow on stack with betterC

Dennis dkorpel at gmail.com
Tue Oct 23 07:59:53 UTC 2018


On Tuesday, 23 October 2018 at 05:36:00 UTC, test wrote:
> correct if I am wrong,  I think malloc is on heap and is very 
> slow.

Yes, you probably want a static array on the stack:

```
scope ubyte[4] tmp = void; // or a default value
```

This is analogous to this C (except scope):
```
unsigned char tmp[4];
```

While 'new' is analogous to 'malloc'.


More information about the Digitalmars-d-learn mailing list