From luke at stat.uiowa.edu  Sun May 25 00:36:11 2008
From: luke at stat.uiowa.edu (Luke Tierney)
Date: Sat, 24 May 2008 17:36:11 -0500 (CDT)
Subject: [Rd] value returned by findFun when the name cannot be found.
In-Reply-To: <27d1e6020805241417l2e9c62a2i3710d23d50733165@mail.gmail.com>
References: <27d1e6020805241417l2e9c62a2i3710d23d50733165@mail.gmail.com>
Message-ID: <Pine.OSX.4.64.0805241732450.723@luke-tierneys-computer-3.local>

On Sat, 24 May 2008, Laurent Gautier wrote:

> Dear list,
>
> I have been using "findVar" (defined in src/main/envir.c) happily and
> would like to use
> "findFun".
>
> However I have trouble when the name searched cannot be found: while
> "findVar" returns R_UnboundValue,
> "findFun" does not (the 4 last lines of "findFun" are copied below).
>
>    error(_("could not find function \"%s\""), CHAR(PRINTNAME(symbol)));
>    /* NOT REACHED */
>    return R_UnboundValue;
> }
>
> I assume that the comment "/* NOT REACHED */ means that R_UnboundValue
> is not returned... and my question is:
> what is returned then ? (I am a little lost in the nested calls within "error").

There is no returned -- the call to 'error' will result in a non-local
exit (executed via longjmp).  The return statement is there to keep
the C compiler happy since it doesn't know about this property of
error and so would issue a warning, ant the /* NOT REACHED */ comment
here (and elswehere) remindes us of this.

Best,

luke

>
>
> Thanks,
>
>
> Laurent
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



[Rd] value returned by findFun when the name cannot be found.
Luke Tierney