On Fri, 5 Aug 2011, Duncan Murdoch wrote:
On 11-08-05 12:09 AM, Alexandre Aguiar wrote:
Hi,
When a function returns a SEXP of type LGLSXP (logical) to signal whether
it succeeded or failed, how is it intrepreted? Is it like C where SUCCESS
= 0 or other value?
Usually TRUE is used to signal success. TRUE is non-zero.
Strictly, TRUE is not numeric: it is coerced to 1 when coerced to a
numeric value.
If you are looking at C level at the SEXP: don't as the internal
representation is just that: 'internal and subject to change'.
There is no C convention to use 0 for success: that is a Unix
convention for status values as returned by exit(), and even there the
man page will advise you to use the symbol EXIT_SUCCESS. Other OSes
do differ.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.