Lim Hock-Chai wrote:
I did below and it compile. Not sure if it will run correctly or not.
But at least it compiled :)
UAM * data;
logECD_STP((char **) &data);
As a general rule, you should aim to code without any casts. Sometimes
they are necessary, but you should do everything you can to avoid them.
As a hard-and-fast rule: Never code a cast unless you understand
_completely_ what the effect will be. You have to understand exactly
what the cast means in terms of the layout of storage it is describing,
and you have to understand exactly what is the actual storage that you
are casting. Only then can you assess whether the cast is valid.
Casting is basically a way to lie to the compiler, and that is A Bad
Thing to do. (I see that Marty already made this point, but I'm
re-making it anyways)
You are telling the compiler that your variable "data" is a "pointer to
character", but it is really a "pointer to UAM". Since you are only
passing 1 parameter to logECD_STP(), it is likely that the function is
treating the parameter as null-terminated string. It is equally
_unlikely_ that your variable "data" actually is a null-terminated string.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.