A
Andre
Hi all,
I have a strange effect in a C compiler for a DSP processor ("VisualDSP").
I want to pass a pointer to a short to a function, which is declared
externally as short x[1000].
So, what I do is:
extern short *x;
and later:
short *my_function(short *a)
{
my code....
}
If I call that function, correctly prototyped, the argument that ends up
in the function is not the pointer, but the value where it points to.
The call would look like
my_function(x);
However, if I do my external declaration like
extern short x[];
everything works fine. No errors, no warnings in both cases.
Question:
What is the difference between
extern short *x;
and
extern short[];
Best regards,
Andre
I have a strange effect in a C compiler for a DSP processor ("VisualDSP").
I want to pass a pointer to a short to a function, which is declared
externally as short x[1000].
So, what I do is:
extern short *x;
and later:
short *my_function(short *a)
{
my code....
}
If I call that function, correctly prototyped, the argument that ends up
in the function is not the pointer, but the value where it points to.
The call would look like
my_function(x);
However, if I do my external declaration like
extern short x[];
everything works fine. No errors, no warnings in both cases.
Question:
What is the difference between
extern short *x;
and
extern short[];
Best regards,
Andre