Can we just drop MSVC support now that we have g++
working? Then we could presumably get rid of this
file.
Does MSVC use different sizes than g++?
Which compiler and bit size are we using on Jenkins?
What's required for CRAN?
If I just leave everything alone with "long long", what
are the consequences?
Does someone else understand Boost fixed-size types or
the built-in fixed size macros well enough to help me out?
What I need is the following constructors for agrad::var:
var()
explicit var(vari*);
var(double);
What I want is to have every arithmetic type use the
var(double) constructor, but there are conflicts with
unsigned long and vari*, despite var(vari*) being explicit.
Yes, I can get enable_if working on my Mac to pick out
arithmetic types, but I can't get it to work on Windows, so
tests fail on Jenkins.
Previously, we just used all of the following
constructors:
var()
explicit var(vari* vi)
var(float), var(double), var(long double)
var(bool), var(short), var(int), var(long), *** var(long long) ***
var(unsigned short), var(unsigned int), var(unsigned long), *** var(unsigned long long) ***
The built-in types don't run into overload conflicts with each
other, but as soon as you get into the typedefs like size_t, uint64_t,
etc., the shit hits the fan when trying to overload.
The problem is that "long long" missed the boat for C++, so is only
in C++11.
Does using long long run afoul of CRAN policy.
The memory models in play are these:
ILP32 LP64 LLP64
char 8 8 8
short 16 16 16
int 32 32 32
long 32 64 32
long long 64 64 64
size_t 32 64 64
pointer 32 64 64
ILP32: 32-bit Windows
LP64: 64-bit linux & mac
LLP64: 64-bit windows
I can't for the life of me figure out how to get the right set of
constructors to cover all inputs and not run into conflicts without
using long long. And it looks like we can't get 64-bit integers
on ILP32 wihtout long long.
We could just punt altogether on long support in autodiff.
I think that'd require some serious test rewriting, and would be
less than ideal for third parties, but I think it may come to that.
We don't need it for running Stan models.
- Bob
> On Mar 1, 2015, at 3:19 AM, Daniel Lee <
notifi...@github.com> wrote:
>
> just poking around in our repo, I see msinttypes.h sitting in
> src/msinttypes.h. It's included in stack_alloc.hpp. Not sure if it helps.
> Looking at it makes me dizzy.
>
> On Sat, Feb 28, 2015 at 11:13 AM, Bob Carpenter <
notifi...@github.com>
> wrote:
>
> > We tried and failed last time to fix this, which is why
> > there were long long left in the code.
> >
> > I'm pretty sure the size situation is this:
> >
> > /* uint ulong size_t AMBIGUOUS
> > * Windows 32 32 32 32 ulong / size_t
> > * Windows 64 32 32 64
> > * Linux/Mac 32 32 64 32
> > * Linux/Mac 64 32 64 64 ulong / size_t
> > */
> >
> > What I need is a set of constructors for var() that can handle
> > any size int and any size unsigned int across platform.
> >
> > I tried the Boost built-in fixed size types and the C built-in
> > fixed size types, but I can't get anything to work without causing
> > ambiguities in constructor resolution on either Windows or the Mac.
> > I tried Boost's size ifdefs, and couldn't get that to work.
> >
> > If I try to get away with just
> >
> > var(double)
> >
> > because whatever the arg is it gets cast to double, it creates
> > ambiguities with
> >
> > explicit var(vari*)
> >
> > even though it's explicit when trying to do:
> >
> > var x(3L);
> >
> > If I just use { uint, size_t }, I miss 64-bit longs on 32-bit Linux/Mac.
> >
> > If I use just { uint, ulong }, I miss 64-bit longs on Windows.
> >
> > C++'s messed up sizing just makes me want to weep.
> >
> > - Bob
> >
> >
> > > On Mar 1, 2015, at 2:49 AM, Daniel Lee <
notifi...@github.com> wrote:
> > >
> > > Yes, you can. See src/test/unit/agrad/rev/matrix/LDLT_alloc_test.cpp:
> > > #ifndef _WIN32
> > >
> > >
> > >
> > > On Sat, Feb 28, 2015 at 10:42 AM, Bob Carpenter <
> >
notifi...@github.com>
> > > wrote:
> > >
> > > > Thanks. It may come down to that, but right now, the
> > > > current failure has me completely stumped.
> > > >
> > > > Unfortunately, the enable-if solution that works just
> > > > fine on the Mac fails utterly on Windows. So I reverted
> > > > to the list of types, which excludes size_t. But that
> > > > is somehow failing on fvar<fvar<var>> determinant calculations.
> > > >
> > > > I have no idea how long long is getting implicated.
> > > >
> > > > I don't actually think there are as many instances of
> > > > the problem as I thought (trying to construct a var with
> > > > a size_t on Windows, where size_t is not equal to unsigned
> > > > long, but rather equal to the illegal until C++11 unsigned
> > > > long long).
> > > >
> > > > - Bob
> > > >
> > > > > On Mar 1, 2015, at 2:27 AM, Daniel Lee <
notifi...@github.com>
> > wrote:
> > > > >
> > > > > Bob, how can I help? Do you want me to set up an account on our
> > Windows
> > > > test box so you can run on it directly?
> > > > >
> > > > > —
> > > > > Reply to this email directly or view it on GitHub.
> > > > >
> > > >
> > > > —
> > > > Reply to this email directly or view it on GitHub
> > > > <
https://github.com/stan-dev/stan/pull/1318#issuecomment-76530976>.
> >
> > > >
> > > —
> > > Reply to this email directly or view it on GitHub.
> > >
> >
> > —
> > Reply to this email directly or view it on GitHub
> > <
https://github.com/stan-dev/stan/pull/1318#issuecomment-76532320>.
> >
> —
> Reply to this email directly or view it on GitHub.
>