× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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 [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.