Re: alloca
- From: Andrey Tarasevich <andreytarasevich@xxxxxxxxxxx>
- Date: Tue, 04 Mar 2008 07:17:02 -0800
Keith Thompson wrote:
....
For example, a compiler can decide to _always_ perform the calls to
argument-forming functions before starting to form the next stack
frame. (no need to single out the 'alloca').
No, a compiler that provides alloca() *doesn't* have to make sure that
the argument passing mechanism works correctly. Since no standard
defines the behavior of alloca(), a compiler is free to leave its
behavior undefined in any circumstances where making it work would be
inconvenient.
...
That's just another way to circumvent the potential problem with using 'alloca' in an argument list. Just say that behavior is undefined in this case. A quality implementation might perform a run-time stack integrity check in debug configuration and trigger a run-time diagnostic.
Although I don't direct connection to the 'alloca' being standard or not. There are perfectly _standard_ features that produce undefined behavior in circumstances "where making it work would be inconvenient". Like, for example, the range of 'ptrdiff_t' is not required to be sufficient for any [otherwise legal] pointer subtraction operation, and trying to subtract pointers which are too far apart produces UB.
--
Best regards,
Andrey Tarasevich
.
- Follow-Ups:
- Re: alloca
- From: Keith Thompson
- Re: alloca
- References:
- alloca
- From: jacob navia
- Re: alloca
- From: Eric Sosman
- Re: alloca
- From: Bartc
- Re: alloca
- From: Eric Sosman
- Re: alloca
- From: Andrey Tarasevich
- Re: alloca
- From: Keith Thompson
- alloca
- Prev by Date: Re: alloca
- Next by Date: Re: alloca
- Previous by thread: Re: alloca
- Next by thread: Re: alloca
- Index(es):
Relevant Pages
|