ewx: (geek)
[personal profile] ewx
...how do the int* x; people declare pointers to functions?

(no subject)

Date: 2006-04-11 10:03 am (UTC)
From: [identity profile] filecoreinuse.livejournal.com
No, they are perfectly well placed in my mental model; they are notations for totally different things. int* x is "int-pointer x" and int (*x)() is "magic rune".

Don't you object to the 'int' being the type in the former case and the return type in the latter? Don't you object that it isn't int function(...) *x?

(no subject)

Date: 2006-04-11 10:07 am (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
No. My mental model of C is that declaration matches use. This has the advantage that it is always correct, because it's the model the language uses, and doesn't need to resort to lameness like "magic rune".

(no subject)

Date: 2006-04-11 10:13 am (UTC)
From: [identity profile] filecoreinuse.livejournal.com
Funny that, my mental model is to just have well defined areas of ignorance coupled with knowledge of where to find answers. This tends to leave more room for useful things. Bit like a cache :).

Which is superior depends on how often one runs up against the areas of ignorance I suspect. This rarely happens in any of my code. Of course we could get into a slanging match or realise that, like many religious wars, each side has the solution that is right for them.

Geeks generally have this sadly mistaken notion that there is always a global optimum which applies to everyone rather than a succession of local maxima which suffice for the people which are standing on that particular hill :).

(no subject)

Date: 2006-04-11 11:30 am (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
void (*signal(int, void (*)(int)))(int);

November 2025

S M T W T F S
      1
2345678
91011121314 15
1617 181920 2122
23242526272829
30      

Most Popular Tags

Expand Cut Tags

No cut tags