Auto variable with sizeof == 0

Chris Torek chris at mimsy.UUCP
Thu Feb 5 03:54:58 AEST 1987


>>>"struct foo **bar[]".

>In article <397 at mipos3.UUCP> pinkas at mipos3.UUCP (Israel Pinkas) writes:
>>I don't see the problem with this declaration. ...
>>
>>	bar = malloc(sizeof(struct foo) * 100)

In article <14575 at amdcad.UUCP> tim at amdcad.UUCP (Tim Olson) writes:
>	^^ Won't work; bar is a *constant* (see pp 94, 95 of K&R)

To be picky, bar is neither a constant nor a variable.  Its value
is set at entry to the function, and cannot be changed within that
function invocation---not without cheating: all automatic variables
are really just names for stack frame offsets, so altering the stack
or frame pointer shuffles all the variables.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list