Since none of you use C compilers I know there will be no risk of cheating.
You're too naïve, >>1-san. I wrote my first ANSI C compiler at the age of 12.
>>16
it is non-initiated data of known length, it belongs on the bss, a pointer to it will be stored on stack or register but the value will point to the bss
>>23
There's a more-specific answer which is also correct if you feel like going for it. There's little point though because you can easily tell from the program output people have posted.
>>24
The exact values are platform specific, but it's going to be the same on current 64bit platforms (and 32bit as well) in common use. If you can tell me a compiler that does something differently on amd64 arch I'd love to hear about it. I'll tell you now that any compiler that doesn't agree with >>13 is in violation of the spec.
(The part you probably think is implementation defined isn't, and it's a thing I wish was marked as incorrect in the spec.)
>>27
Are you saying that the stack can't be aligned arbitrarily by the compiler? Surely the standard doesn't demand that all the locals be packed together like that, that would be silly.
There are some silly things in the C spec, nonsense holdovers from BCPL, the various meanings of static, some would argue const shenanigans (I'm not one of them, but I acknowledge it's less effective than intended... I certainly wouldn't go overboard and ban type qualifiers from my language.)
Name:
Anonymous2011-10-20 0:57
>>31
Yes, but I mean is &x+1 really guaranteed to point immediately after the end of x? Isn't it allowed for there to be padding after x to allow x+1 to be aligned? Is it even guaranteed that x+1 won't be temporarily stored somewhere totally different in memory, separate from the stack?
Name:
Anonymous2011-10-20 1:15
>>31
When quoting only two posts please refrain from using the range operator `-' and use the list operator `,' instead, as this will result in less space taken up by the operator on non-monospace fonts, thank you.
>>35 Forget about the array
Here open the gates of hell.
The way I see it, int x[5] being an array and not an struct, it's not allowed
Here open the gates of heaven.
Name:
Anonymous2011-10-20 2:28
Here's what it printed on my DeathStation 9000 before the demons flew out of my nose.
DATPTR:POINTER TO AUTO INT 'x[0]' IN 'main' INVOCATION 0
DATPTR:POINTER TO AUTO INT 'x[1]' IN 'main' INVOCATION 0
SPCPTR:POINTER TO AUTO ARRAY OF 5 INT 'x' IN 'main' INVOCATION 0
MCHCHK: YA DUN GOOF'D ON LINE 7
>2011
>EXCEEDING ALLOCATED PROGRAM AUTOMATIC STORAGE AREA
I SERIOUSLY HOPE YOU GUYS DON'T DO THIS.
SYSTEM HALTED.