std::cerr in stanc

5 views
Skip to first unread message

Jiqiang Guo

unread,
Oct 24, 2012, 7:32:44 PM10/24/12
to stan...@googlegroups.com
R CMD CHECK on the rstan package indicates that std::cerr is used in stanc. 

I found it was added at 

Could we get rid of that?

--
Jiqiang

Bob Carpenter

unread,
Oct 25, 2012, 1:34:24 PM10/25/12
to stan...@googlegroups.com
Is std::cout OK, but std::cerr not?

We could factor out a base implementation
that just takes streams if that's better.
So it'd be:

int main(...) {
return foo(...,&std::cout,&std::cerr);
}

and then in a different file, that you wouldn't
need for R, we'd have:

int foo(...,ostream* out, ostream* err) {
... current body of main with ***
}

- Bob
> --
>
>

Jiqiang Guo

unread,
Oct 25, 2012, 1:43:50 PM10/25/12
to stan...@googlegroups.com
On Thu, Oct 25, 2012 at 1:34 PM, Bob Carpenter <ca...@alias-i.com> wrote:
Is std::cout OK, but std::cerr not?
 
Neither std::cout nor std::cerr is good. 


We could factor out a base implementation
that just takes streams if that's better.
So it'd be:

  int main(...) {
    return foo(...,&std::cout,&std::cerr);
  }

and then in a different file, that you wouldn't
need for R, we'd have:

  int foo(...,ostream* out, ostream* err) {
     ... current body of main with ***
  }
 
This will work.  


- Bob


On 10/24/12 7:32 PM, Jiqiang Guo wrote:
R CMD CHECK on the rstan package indicates that std::cerr is used in stanc.

I found it was added at
https://code.google.com/p/stan/source/detail?r=54333acd69c8ab5445b8af48edd91732c9c344d1#

Could we get rid of that?

--
Jiqiang

--



--



Bob Carpenter

unread,
Oct 25, 2012, 1:48:26 PM10/25/12
to stan...@googlegroups.com
OK, will do. It'll only take a second.

- Bob

On 10/25/12 1:43 PM, Jiqiang Guo wrote:
>
>
> On Thu, Oct 25, 2012 at 1:34 PM, Bob Carpenter <ca...@alias-i.com <mailto:ca...@alias-i.com>> wrote:
>
> Is std::cout OK, but std::cerr not?
>
> Neither std::cout nor std::cerr is good.
>
>
> We could factor out a base implementation
> that just takes streams if that's better.
> So it'd be:
>
> int main(...) {
> return foo(...,&std::cout,&std::cerr)__;
> }
>
> and then in a different file, that you wouldn't
> need for R, we'd have:
>
> int foo(...,ostream* out, ostream* err) {
> ... current body of main with ***
> }
>
> This will work.
>
>
>
> - Bob
>
>
> On 10/24/12 7:32 PM, Jiqiang Guo wrote:
>
> R CMD CHECK on the rstan package indicates that std::cerr is used in stanc.
>
> I found it was added at
> https://code.google.com/p/__stan/source/detail?r=__54333acd69c8ab5445b8af48edd917__32c9c344d1#
> <https://code.google.com/p/stan/source/detail?r=54333acd69c8ab5445b8af48edd91732c9c344d1#>
>
> Could we get rid of that?
>
> --
> Jiqiang
>
> --
>
>
>
> --
>
>
>
> --
>
>
Reply all
Reply to author
Forward
0 new messages