Laurent Gautier
2008-May-24 21:17 UTC
[Rd] value returned by findFun when the name cannot be found.
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"). Thanks, Laurent
Luke Tierney
2008-May-24 22:36 UTC
[Rd] value returned by findFun when the name cannot be found.
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