definition of R_problem_buf in S.h (PR#210)

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Mon, 14 Jun 1999 18:41:39 +0200 (CEST)


>>>>> Martin Maechler writes:

>>>>> On Mon, 14 Jun 1999 17:56:06 +0200 (MET DST), vogels@ieee.org said:
vogels> Full_Name: Thomas Vogels Version: 0.64.1 OS: AIX 4.2 Submission
vogels> from: (NULL) (198.133.22.70)


vogels> R_problem_buf is defined, not just declared, in S.h:

vogels> #define R_PROBLEM_BUFSIZE 4096 char
vogels> R_problem_buf[R_PROBLEM_BUFSIZE];

vogels> This is bad since every time S.h is included this buffer is
vogels> defined.  The linker will eventually complain about multiple
vogels> definitions of this symbol.
> no.
> All our include files ``idempotent'' : Including them multiple times
> doesn't change anything.
> This protection is *very* standard and is achieved by (for the case of S.h) 

> #ifndef R_S_H
> #define R_S_H
> .................. everything ......
> #endif

vogels> Solution: declare R_problem_buf to be extern in S.h, then
vogels> allocate memory for it in a source file, like main.c with: char
vogels> R_problem_buf[R_PROBLEM_BUFSIZE];

> Not the real solution, main.c does not even include S.h !

Right.

Is there a way we can suggest a better interface here?  I really hate
the PROBLEM xxx RECOVER(NULL_ENTRY) lines.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._