[TUHS] C declarations.

Bakul Shah bakul at bitblocks.com
Mon May 15 14:54:16 AEST 2017


On Mon, 15 May 2017 14:35:34 +1000 Dave Horsfall <dave at horsfall.org> wrote:
> On Sat, 13 May 2017, Bakul Shah wrote:
> 
> > int*()* f	// f is a ptr to function returning ptr to int
> 
> Nope.
> 
>     aneurin% cdecl
>     Type `help' or `?' for help
>     explain int*()* f
>     syntax error
>     declare f as ptr to function returning ptr to int
>     int *(*f)()
> 
> (Sigh; "cdecl" really needs to print a "> " prompt or something.)

Sorry, I was less than clear.  I was just doing a thought
experiment about an alternate declaration syntax.  Requoting
from my email:

                             But if you put the var all the way
  to the right and read a declaration right to left, it works:

Basically suggesting that if all type machinery *preceded* an
object declaration (including for functions), we don't need any
parentheses and declarations are very easy to understand --
you just read a declaration from right to left. So no need
for cdel!  Too late for this, of course!


More information about the TUHS mailing list