I have encountered a working (with XLC8 and MSFT9 compilers) piece of code, containing a C++ file with a function defined with C linkage and a reference argument. This bugs
That's what Bjarne Stroustrup has to say about references:
"Most references are implements are implemented using a pointer variable; that it a reference usually takes up one word of memory. However, a reference that is used purely locally can - and often is - eliminated by the optimizer".
For example:
struct S
{
int a;
int b[100];
}; // just an example
void do_something(const vector& v)
{
for (int i=0; i
In this case, p needs not be stored in memory (maybe it just exists in a register, maybe it disappears into the instructions).