On 4/22/18 3:17 AM, Cym13 wrote:
On Sunday, 22 April 2018 at 05:29:30 UTC, Mike Franklin wrote:
On Sunday, 22 April 2018 at 00:41:34 UTC, Nicholas Wilson wrote:
You're not using the C library version of it, the compiler does the
stack space reservation inline for you. There is no way around th
On Sunday, 22 April 2018 at 05:29:30 UTC, Mike Franklin wrote:
I'm not convinced. I did some no-runtime testing and
eventually found the implementation in druntime here
It seems to me that it's an odd thing to have what apparently
looks like a function call an intrinsic part of the language.
On Sunday, 22 April 2018 at 05:29:30 UTC, Mike Franklin wrote:
On Sunday, 22 April 2018 at 00:41:34 UTC, Nicholas Wilson wrote:
You're not using the C library version of it, the compiler
does the stack space reservation inline for you. There is no
way around this.
I'm not convinced. I did s
On Sunday, 22 April 2018 at 00:41:34 UTC, Nicholas Wilson wrote:
You're not using the C library version of it, the compiler does
the stack space reservation inline for you. There is no way
around this.
I'm not convinced. I did some no-runtime testing and eventually
found the implementation
On Sunday, April 22, 2018 01:07:44 Giles Bathgate via Digitalmars-d-learn
wrote:
> On Saturday, 21 April 2018 at 19:06:52 UTC, Steven Schveighoffer
>
> wrote:
> > alloca is an intrinsic, and part of the language technically --
> > it has to be.
>
> Why does:
>
> scope c = new C(); // allocat
On 4/21/18 7:47 PM, Mike Franklin wrote:
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven Schveighoffer wrote:
alloca is an intrinsic, and part of the language technically -- it has
to be.
From what I can tell `alloca` is only available in the platform's C
standard library (actually for L
On Sunday, 22 April 2018 at 01:26:09 UTC, Uknown wrote:
Its a special case for classes. Makes them usable without the
GC.
The intention was actually just to have deterministic destruction
- a scope class ctor runs at the end of scope (and it used to be
you could force a class to always be sco
On Sunday, 22 April 2018 at 01:07:44 UTC, Giles Bathgate wrote:
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven
Schveighoffer wrote:
alloca is an intrinsic, and part of the language technically
-- it has to be.
Why does:
scope c = new C(); // allocate c on stack
scope a = new char[le
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven Schveighoffer
wrote:
alloca is an intrinsic, and part of the language technically --
it has to be.
Why does:
scope c = new C(); // allocate c on stack
scope a = new char[len]; // allocate a via gc?
On Saturday, 21 April 2018 at 23:47:41 UTC, Mike Franklin wrote:
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven
Schveighoffer wrote:
alloca is an intrinsic, and part of the language technically
-- it has to be.
From what I can tell `alloca` is only available in the
platform's C standard
On Saturday, 21 April 2018 at 19:06:52 UTC, Steven Schveighoffer
wrote:
alloca is an intrinsic, and part of the language technically --
it has to be.
From what I can tell `alloca` is only available in the platform's
C standard library (actually for Linux it appears be part of
libgcc as `__b
On Saturday, 21 April 2018 at 14:25:58 UTC, Cym13 wrote:
On Saturday, 21 April 2018 at 13:54:14 UTC, H. S. Teoh wrote:
On Sat, Apr 21, 2018 at 01:30:55PM +, Cym13 via
Digitalmars-d-learn wrote:
On Saturday, 21 April 2018 at 12:08:09 UTC, Dmitry Olshansky
wrote:
[...]
> Unbounded allocation
On 4/21/18 3:57 AM, Uknown wrote:
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack? I'm
looking for something roughly equivalent to the following C code.
int doSomething(size_t len)
{
char stackBuffer[len + 1];
On Saturday, 21 April 2018 at 13:30:55 UTC, Cym13 wrote:
On Saturday, 21 April 2018 at 12:08:09 UTC, Dmitry Olshansky
wrote:
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin
wrote:
Does D have some way to dynamically allocate on the stack?
I'm looking for something roughly equivalent
On Saturday, 21 April 2018 at 13:30:55 UTC, Cym13 wrote:
[...]
Nevermind, forgot that shared libraries are put between the two.
On Saturday, 21 April 2018 at 13:54:14 UTC, H. S. Teoh wrote:
On Sat, Apr 21, 2018 at 01:30:55PM +, Cym13 via
Digitalmars-d-learn wrote:
On Saturday, 21 April 2018 at 12:08:09 UTC, Dmitry Olshansky
wrote:
[...]
> Unbounded allocation on stack is kind of anti-pattern and a
> potential DoS v
On Sat, Apr 21, 2018 at 01:30:55PM +, Cym13 via Digitalmars-d-learn wrote:
> On Saturday, 21 April 2018 at 12:08:09 UTC, Dmitry Olshansky wrote:
[...]
> > Unbounded allocation on stack is kind of anti-pattern and a
> > potential DoS vector.
>
> I'm having trouble seeing how unbounded heap allo
On Saturday, 21 April 2018 at 12:08:09 UTC, Dmitry Olshansky
wrote:
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack?
I'm looking for something roughly equivalent to the following
C code.
int doSomething(size_t len)
{
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack? I'm
looking for something roughly equivalent to the following C
code.
int doSomething(size_t len)
{
char stackBuffer[len + 1];
doSomethingElse(stackBuffer);
}
On Saturday, 21 April 2018 at 10:47:47 UTC, Timon Gehr wrote:
That does not work (you are returning a dangling reference into
the stack of the function that is returning).
Yeah I had hoped that the pragma(inline, true) would solve that,
but it dosesn't :(
On 21.04.2018 12:08, Giles Bathgate wrote:
On Saturday, 21 April 2018 at 07:57:41 UTC, Uknown wrote:
The language itself doesn't have something, but you could use `alloca`
I don't know if this little template function makes life easier:
--
pragma(inline, true)
ref T push(T)(size_t len)
{
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack? I'm
looking for something roughly equivalent to the following C
code.
int doSomething(size_t len)
{
char stackBuffer[len + 1];
doSomethingElse(stackBuffer);
}
On Saturday, 21 April 2018 at 10:08:43 UTC, Giles Bathgate wrote:
I don't know if this little template function makes life easier:
Sorry, that doesn't work at all.
On Saturday, 21 April 2018 at 07:57:41 UTC, Uknown wrote:
The language itself doesn't have something, but you could use
`alloca`
I don't know if this little template function makes life easier:
--
pragma(inline, true)
ref T push(T)(size_t len)
{
import core.stdc.stdlib, core.stdc.stdio
On Saturday, 21 April 2018 at 07:57:41 UTC, Uknown wrote:
The language itself doesn't have something.
It would be cool if you could just do
int doSomething(size_t len)
{
char stackBuffer = push char[len + 1];
doSomethingElse(stackBuffer);
}
i.e some kind of `push` ke
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack? I'm
looking for something roughly equivalent to the following C
code.
int doSomething(size_t len)
{
char stackBuffer[len + 1];
doSomethingElse(stackBuffer);
}
T
Does D have some way to dynamically allocate on the stack? I'm
looking for something roughly equivalent to the following C code.
int doSomething(size_t len)
{
char stackBuffer[len + 1];
doSomethingElse(stackBuffer);
}
Thanks,
Mike
27 matches
Mail list logo