{"action":"created","issue":{"url":"https://api.github.com/repos/PixarAnimationStudios/OpenSubdiv/issues/622","labels_url":"https://api.github.com/repos/PixarAnimationStudios/OpenSubdiv/issues/622/labels{/name}","comments_url":"https://api.github.com/repos/PixarAnimationStudios/OpenSubdiv/issues/622/comments","events_url":"https://api.github.com/repos/PixarAnimationStudios/OpenSubdiv/issues/622/events","html_url":"https://github.com/PixarAnimationStudios/OpenSubdiv/issues/622","id":86921015,"number":622,"title":"VS2013 Build Errors - more than one [] operator for StackBuffer","user":{"login":"thomthom","id":192418,"avatar_url":"https://avatars.githubusercontent.com/u/192418?v=3","gravatar_id":"","url":"https://api.github.com/users/thomthom","html_url":"https://github.com/thomthom","followers_url":"https://api.github.com/users/thomthom/followers","following_url":"https://api.github.com/users/thomthom/following{/other_user}","gists_url":"https://api.github.com/users/thomthom/gists{/gist_id}","starred_url":"https://api.github.com/users/thomthom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomthom/subscriptions","organizations_url":"https://api.github.com/users/thomthom/orgs","repos_url":"https://api.github.com/users/thomthom/repos","events_url":"https://api.github.com/users/thomthom/events{/privacy}","received_events_url":"https://api.github.com/users/thomthom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-10T10:35:45Z","updated_at":"2015-06-10T18:13:23Z","closed_at":null,"body":"I observe build errors in Visual Studio 2013 (OpenSubdiv 3.0.0 RC1).\r\n\r\nCMake config to generate Vs solution:\r\n\r\n```cmake\r\ncmake ^\r\n  -G \"Visual Studio 12 2013\" ^\r\n  -DNO_EXAMPLES=1 ^\r\n  -DNO_TUTORIALS=1 ^\r\n  -DNO_REGRESSION=1 ^\r\n  -DNO_MAYA=1 ^\r\n  -DNO_PTEX=1 ^\r\n  -DNO_DOC=1 ^\r\n  -DNO_OMP=1 ^\r\n  -DNO_TBB=1 ^\r\n  -DNO_CUDA=1 ^\r\n  -DNO_OPENCL=1 ^\r\n  -DNO_OPENGL=1 ^\r\n  -DNO_CLEW=1 ^\r\n  ..\r\n```\r\n\r\nFull error list upon build: https://gist.github.com/thomthom/cfadd7d384d8b394aabb\r\n\r\n![2015-06-10_11h46_50](https://cloud.githubusercontent.com/assets/192418/8080347/05ad9a46-0f6c-11e5-804d-88da034cad7d.png)\r\n\r\nAll the errors appear to be related to the same thing. Patterns like this:\r\n\r\n```cpp\r\n    internal::StackBuffer<Index,16> cVertEdgeBuffer;\r\n\r\n    ConstIndexArray pVertEdges = _parentLevel.getVertexEdges(pVert);\r\n    ConstIndexArray cVertEdges;\r\n\r\n    //  Beware accessing the child's vert-edges -- full topology may not be enabled:\r\n    if (_childLevel.getNumVertexEdgesTotal()) {\r\n        cVertEdges = _childLevel.getVertexEdges(cVert);\r\n    } else {\r\n        cVertEdgeBuffer.SetSize(pVertEdges.size());\r\n\r\n        ConstLocalIndexArray pVertInEdge = _parentLevel.getVertexEdgeLocalIndices(pVert);\r\n        for (int i = 0; i < pVertEdges.size(); ++i) {\r\n            cVertEdgeBuffer[i] = _refinement.getEdgeChildEdges(pVertEdges[i])[pVertInEdge[i]];\r\n        }\r\n        cVertEdges = IndexArray(cVertEdgeBuffer, pVertEdges.size());\r\n    }\r\n```\r\n\r\nIt's the `cVertEdgeBuffer[i]` that chokes - VS doesn't like `int` being passed to `[]` which signature accepts `unsigned int`.\r\n\r\nIf I made a `static_cast` of `i` then there'd be no error.\r\n\r\nAs a quick and dirty test I added an overload to `StackBuffer` and that allowed the build to complete with no errors:\r\n\r\n```cpp\r\n    TYPE &       operator[](int index)        { return _data[static_cast<size_type>(index)]; }\r\n    TYPE const & operator[](int index) const  { return _data[static_cast<size_type>(index)]; }\r\n```\r\n![2015-06-10_12h21_08](https://cloud.githubusercontent.com/assets/192418/8080442/dc187f60-0f6c-11e5-8194-db3556825475.png)\r\n\r\nI would submit a patch, but I'm not sure what the preferred fix would be. (Plus I saw that I need to sign that agreement before submitting contributions.)"},"comment":{"url":"https://api.github.com/repos/PixarAnimationStudios/OpenSubdiv/issues/comments/110860627","html_url":"https://github.com/PixarAnimationStudios/OpenSubdiv/issues/622#issuecomment-110860627","issue_url":"https://api.github.com/repos/PixarAnimationStudios/OpenSubdiv/issues/622","id":110860627,"user":{"login":"barfowl","id":4130807,"avatar_url":"https://avatars.githubusercontent.com/u/4130807?v=3","gravatar_id":"","url":"https://api.github.com/users/barfowl","html_url":"https://github.com/barfowl","followers_url":"https://api.github.com/users/barfowl/followers","following_url":"https://api.github.com/users/barfowl/following{/other_user}","gists_url":"https://api.github.com/users/barfowl/gists{/gist_id}","starred_url":"https://api.github.com/users/barfowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barfowl/subscriptions","organizations_url":"https://api.github.com/users/barfowl/orgs","repos_url":"https://api.github.com/users/barfowl/repos","events_url":"https://api.github.com/users/barfowl/events{/privacy}","received_events_url":"https://api.github.com/users/barfowl/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T18:13:22Z","updated_at":"2015-06-10T18:13:22Z","body":"A member of the team tried it on both VS2010 and VS2013 and couldn't\nreproduce it.  I'll let him provide details.\n\nCan you please verify that a sign change to StackBuffer resolves issue?  If\nwe change its size_type to signed there is a little more to be changed, but\nchanging the argument to operator[] to \"int index\" should suffice for\ntesting.\n\nThanks\n\nOn Wed, Jun 10, 2015 at 11:05 AM, Thomas Thomassen <notifications@github.com\n> wrote:\n\n> So these people with VS2013, was their project configured to use the vs2013\n> compiler? Or did it use an older like vs2010?\n> I tried on two different systems now and both failed.\n>\n>\n>\n>\n> Sent using CloudMagic [\n> https://cloudmagic.com/k/d/mailapp?ct=pa&cv=6.3.35&pv=5.0.2]\n>\n>\n> On Wed, Jun 10, 2015 at 7:53 PM, barfowl < notifications@github.com [\n> notifications@github.com] > wrote:\n> Sorry, I misread your last email -- I was referring to changing\n> StackBuffer::size_type to signed not ConstArray::size_type to unsigned.\n>\n> ConstArray is intended to directly return sizes that are internally 32-bit\n> signed and passed on as signed, so I would prefer not to change that.\n>\n>\n> On Wed, Jun 10, 2015 at 10:30 AM, Barry Fowler <\n> barry.fowler@dreamworks.com>\n> wrote:\n>\n> > I don't have access to MSVC but I'm told others are not having this\n> > problem -- with earlier versions or with 2013. This code is being\n> > instantiated in a template on the client side though and is subject to\n> > whatever compiler settings used there, which may be stricter.\n> >\n> > I'm not opposed to changing the size to \"int\" though. The issue may be\n> > that we start to get more warnings from casts from unsigned to signed,\n> but\n> > most usage likely already uses signed. It's used internally though so we\n> > should be able to deal with that.\n> >\n> > I'll look into it and don't mind making the change if that's fine with\n> the\n> > rest of the team.\n> >\n> > On Wed, Jun 10, 2015 at 5:42 AM, Thomas Thomassen <\n> > notifications@github.com> wrote:\n> >\n> >> class ConstArray {\n> >> public:\n> >> typedef TYPE value_type;\n> >> typedef int size_type;\n> >>\n> >> ...\n> >>\n> >> const_reference operator[](int index) const { return _begin[index]; }\n> >>\n> >> I saw there was a comment that the size type was intentionally 32bit to\n> >> avoid 64bit conversion - hence the int. But can it be unsigned?\n> >>\n> >> —\n> >> Reply to this email directly or view it on GitHub\n> >>\n> <\n> https://github.com/PixarAnimationStudios/OpenSubdiv/issues/622#issuecomment-110734789\n> >\n> >> .\n> >>\n> >\n> >\n> —\n> Reply to this email directly or view it on GitHub\n> [\n> https://github.com/PixarAnimationStudios/OpenSubdiv/issues/622#issuecomment-110852774]\n> .[\n> https://github.com/notifications/beacon/AALvokS9y9QO98RSvwt78VoNPubPkxb-ks5oSHEbgaJpZM4E-RV8.gif]\n>\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/PixarAnimationStudios/OpenSubdiv/issues/622#issuecomment-110858008>\n> .\n>\n"}}