function returning pointer to itself

Rick Coates rickc at agora.UUCP
Tue Jul 19 07:57:25 AEST 1988


In article <5485 at batcomputer.tn.cornell.edu>, olson at batcomputer.tn.cornell.edu (olson) writes:
> Does the new C standard have a natural way to declare a
> function that returns a pointer to itself
> ????
> 
(deleted)
(several more articles, with obscure declartions)


Please forgive me if I'm missing something obvious here.....
(I used to be a hardware person - what can I say).

I just tried this out on the only dpANSI compiler I have available -
Microsoft C 5.1 for IBM pc's (this is ironic because I do a lot of work
on a Sun 4 - great machine but no ANSI C; I also work  on Masscomp machines,
which also have no ANSI compiler. When are the Big Boys (medium boys, anyway)
going to support ANSI C?).

This seems to work fine. Compiles with no errors or warnings.

Isn't this a reasonable use of void *   ???
It isn't even Ugly!
-------------program------------
void * test_func();

main()
{
    printf("test: %x\n",test_func);
}

void *
test_func()
{
    return test_func;
}
-------------results-------------

test: 24

---------------------------------

Rick Coates

tektronix!reed!percival!agora!rickc
OR
tektronix!sequent!islabs!ateq!rick



More information about the Comp.std.c mailing list