Translation of C function pointer.

Simen kjaeraas simen.kjaras at gmail.com
Fri Sep 17 05:00:55 PDT 2010


On Fri, 17 Sep 2010 10:12:34 +0200, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Thursday 16 September 2010 23:50:16 Kagamin wrote:
>> BCS Wrote:
>> > The trick is that function pointers are best read from the inside out.
>>
>> All C declarations are read from inside out, postfixes take precedence,
>> that's why you have to use braces to give pointer higher precedence. One
>> of the earlier books by Stroustroup gives a nice monster of arrays,
>> pointers and functions to master understanding of declarations.
>
> It's essentially the same principle that makes it so that the D  
> declaration
>
> int[4][3] a;
>
> is an array with 3 rows and 4 columns rather than 4 rows and 3 columns  
> like
> you'd expect.

I've always been confused by C in this regard. It seems to logical to me
that T[3] works the same whether T is U[4] or U.

-- 
Simen


More information about the Digitalmars-d-learn mailing list