C Interpreter and sizeof operator
- From: ozbear@xxxxxxxxxxx (ozbear)
- Date: Tue, 29 Nov 2005 23:09:01 GMT
If one were writing a C interpreter, is there anything in the standard
standard that requires the sizeof operator to yield the same value for
two different variables of the same type?
Let's assume that the interpreter does conform to the range values
for, say, type int, but allocates storage for the variables based
on their value. So, for two variables foo and bar
int foo = 0; /* interpreter allocates two bytes */
int bar = 200000000; /* interpreter allocates four bytes */
Does the standard require that sizeof foo == sizeof bar thereby
making this allocation scheme broken, unless hidden in some way?
Or is it perfectly acceptable for the sizeof operator to different
results?
Regards, Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.
- Follow-Ups:
- Re: C Interpreter and sizeof operator
- From: Christian Bau
- Re: C Interpreter and sizeof operator
- From: Skarmander
- Re: C Interpreter and sizeof operator
- From: Mike Wahler
- Re: C Interpreter and sizeof operator
- Prev by Date: Re: C function for returning number of digits?
- Next by Date: Re: Why different from expectation
- Previous by thread: Array size depending on symbol address
- Next by thread: Re: C Interpreter and sizeof operator
- Index(es):
Relevant Pages
|