From Martin Maechler <maechler@stat.math.ethz.ch>  Mon Jun 14 17:30:42 1999
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Mon, 14 Jun 1999 18:30:42 +0200
Subject: definition of R_problem_buf in S.h (PR#210)
In-Reply-To: <199906141556.RAA00751@pubhealth.ku.dk> (vogels@ieee.org)
References: <199906141556.RAA00751@pubhealth.ku.dk>
Message-ID: <199906141630.SAA07559@sophie.ethz.ch>

>>>>> 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 !

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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