Re: Cannot understand the following codes
- From: Ben C <spamspam@xxxxxxxxx>
- Date: 30 Mar 2006 09:01:59 GMT
On 2006-03-29, Arthur J. O'Dwyer <ajonospam@xxxxxxxxxxxxxx> wrote:
On Wed, 29 Mar 2006, Ben C wrote:
[..] The difference between (*r) and (r) is that (*r) is the thing
pointed to by 'r', which is of function type, which, in this context,
immediately decays back to a function pointer. (r) is just that same
function pointer, without the dereference and decay. In other words,
(*r) decays to (r). Therefore, both expressions have the /exact same/
behavior.
I think more old code used the (*f)(x) style, and newer code, maybe
influenced by C++ and Lispy languages, uses plain old f(x) more often.
I tend to use (*cmp)(x,y) for callback functions in things like 'qsort',
but if I were writing something like
int (*printme)() = (widget == on)? magic: more_magic;
I'd use
printme(x);
instead.
Thanks. I tend to use (*f) just as a hint to the reader that it's an
indirect call.
.
- References:
- Cannot understand the following codes
- From: gpsabove
- Re: Cannot understand the following codes
- From: Alf P. Steinbach
- Re: Cannot understand the following codes
- From: Ben C
- Re: Cannot understand the following codes
- From: Alf P. Steinbach
- Re: Cannot understand the following codes
- From: Ben C
- Re: Cannot understand the following codes
- From: Joe Wright
- Re: Cannot understand the following codes
- From: Ben C
- Re: Cannot understand the following codes
- From: Arthur J. O'Dwyer
- Cannot understand the following codes
- Prev by Date: Re: String concatenation design
- Next by Date: Re: String concatenation design
- Previous by thread: Re: Cannot understand the following codes
- Next by thread: Re: Cannot understand the following codes
- Index(es):
Relevant Pages
|