"array" vs. "&array" ? (not again! :-O )

Chuck Phillips chuckp at ncr-fc.FtCollins.NCR.com
Thu Jan 11 04:32:28 AEST 1990


]In article <24521 at gryphon.COM> bagpiper at pnet02.gryphon.com (Michael Hunter) writes:
]chuckp at ncr-fc.FtCollins.NCR.com (Chuck Phillips) writes:
]>In article <2378 at ektools.UUCP> randolph at ektools.UUCP (Gary L. Randolph) writes:
]>>   Am I wrong in the inference from K&R that:

]>>   float arrf[3] = {1.2,2.3,3.4};
]>>   arrf;            /*evaluates to pointer to float according to K&R*/

]>When declaring/defining arrf, space is allocated for a pointer to the array
]>_in the symbol table_, _not_ in the actual object code.  (i.e.  this address
]>may not manifest itself in the object code at all if never referenced)

]>> &arrf; /*evaluates to pointer to pointer to float (my inference)*/

]>So now, as I understand it, you're asking for a pointer to something that
]>exists in the symbol table that is often stripped from the final version of
]>programs.

]This must be done by the linker or some postprocessor of the
]executable...otherwise how could the compiler tell that a object is not
]referenced in some other module (even static functions or varaibles via
]pointers.)

Granted.  But the question remains: "What is the compiler supposed to do when
the programmer askes for a pointer to something in the symbol table?"

Personally I like the idea of hysterical electronic laughter, but was asking
what ANSI had specified.

Before someone else does, let me flame myself:
#pragma FLAME_ON
Please add to the list of the most commonly deserved answers to the most
commonly asked C questions instructions for obtaining the ANSI C standard.
(i.e. how to get TFM)
#pragma FLAME_ON

Question: Wouldn't it be _really neat_ if the actual ANSI C standard were
commonly available in CS related bookstores?

#include <std/disclaimer.h>
--
	   Chuck Phillips -- chuckp%bach.ncr-fc.FtCollins.NCR.COM



More information about the Comp.lang.c mailing list