As said by others the short answer is 'no'.
However reading implementer docs or even reverse engineering could allow you to make such assumptions (or not).
I ran this example at cpp.sh which says void*
is size 8 and diff is (-32):
// Example program
#include <iostream>
#include <string>
#include <alloca.h>
#include <stdint.h>
int main()
{
void *var1 = alloca(sizeof var1);
std::cout << "sizeof var1: " << sizeof var1 << std::endl;
std::cout << "var1 addr: " << var1 << std::endl;
void *var2 = alloca(sizeof var2);
std::cout << "var2 addr: " << var2 << std::endl;
intptr_t diff = (intptr_t)var2 - (intptr_t)var1;
std::cout << "addr diff: " << diff << std::endl;
}
Huh. Not contiguous. Maybe there is some simple padding going on.
Making allocation of size 128 byte gives a diff of (-144):
// Example program
#include <iostream>
#include <string>
#include <alloca.h>
#include <stdint.h>
int main()
{
int size = 128;
void *var1 = alloca(size);
std::cout << "var1 addr: " << var1 << std::endl;
void *var2 = alloca(size);
std::cout << "var2 addr: " << var2 << std::endl;
intptr_t diff = (intptr_t)var2 - (intptr_t)var1;
std::cout << "addr diff: " << diff << std::endl;
}
Hm. Alignment is not restricted to 32-byte...
Further reverse engineering left as student excercise.
(From just two tests I have a pretty good guess of what is going on without any documentation. Making a few more should narrow it down quite a bit.)