Re: Another sizeof question
- From: richard@xxxxxxxxxxxxxxx (Richard Tobin)
- Date: 19 Sep 2007 11:03:47 GMT
In article <pan.2007.09.19.10.22.54.771614@xxxxxxxxx>,
Army1987 <army1987@xxxxxxxxx> wrote:
int n = 42;
char x[n];
Even in this case, x's type is a VLA, but x[999]'s type is char,
so it is not evaluated by sizeof.
Oops, yes. Then what about
int n = 42;
char x[n][n];
sizeof(x[999]);
I can't see how it could cause a problem in practice, because what would
the compiler do with the result of computing x[999] anyway?
I haven't looked at how compilers handle this sort of thing, but I assume
they perform a kind of abstract interpretation in which expressions are
evaluated for their type rather than their value.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
.
- Follow-Ups:
- Re: Another sizeof question
- From: Keith Thompson
- Re: Another sizeof question
- From: Charlie Gordon
- Re: Another sizeof question
- References:
- Another sizeof question
- From: Richard Tobin
- Re: Another sizeof question
- From: Army1987
- Another sizeof question
- Prev by Date: Re: pass by value
- Next by Date: Re: EOF
- Previous by thread: Re: Another sizeof question
- Next by thread: Re: Another sizeof question
- Index(es):
Relevant Pages
|
Loading