Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3281326
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:48:12+00:00 2026-05-17T19:48:12+00:00

that’s the code: static inline void shrinkData(const vector<Data> &data, unsigned short shrinkType){ #define CASE_N(N)

  • 0

that’s the code:

static inline void 
shrinkData(const vector<Data> &data, unsigned short shrinkType){
    #define CASE_N(N) \
    case(N): \
        ptr = MemoryManager::requestMemory(n*sizeof(ShrinkData<N>)); \
        for(int i=0; i<n; i++){ \
            new(ptr) ShrinkData<N>(data[i]); \
            ptr+=sizeof(ShrinkData<N>); \
        } \
        return;


    int n = data.size();
    char* ptr;

    switch(shrinkType){
    case(0):
        return;
    CASE_N(1)
    CASE_N(2)
    CASE_N(3)
    ....
    CASE_N(255)
}

now I get a fatal “error C1061: compiler limit : blocks nested too deeply” on line CASE_N(124)

can someone please tell me why this happens? actually the nesting should not be deeper than 2, no?

Thanks!

//edit: the requested constructor (the constructor works just fine without this switch function)

enum {//maximally 16 to fit in a unsigned short!
    EID_POSITION        =   1, //bit1
    EID_T               =   2, //bit2
    EID_GEOMNORMAL      =   4, //bit3
    EID_NORMAL          =   8, //bit4
    EID_TANGENTS        =  16, //bit5
    EID_TEXCOORDS       =  32, //bit6
    EID_RAYDIR          =  64, //bit7
    EID_RECURSIONDEPTH  = 128  //bit8
};



template<unsigned, unsigned>
struct IDataMember{
    IDataMember(){}
    IDataMember(const Data &iData){}
};


template<>
struct IDataMember<EID_POSITION, EID_POSITION>{
    IDataMember(): position(Vector3(0,0,0)){}
    IDataMember(const Data &iData):position(iData.position){}
    Vector3 position;
};

… the same kind of template specialisation for each type in the enums…

template<unsigned members>
struct ShrinkData
    :public IDataMember<members & EID_POSITION, EID_POSITION>
    ,public IDataMember<members & EID_T, EID_T>
    ,public IDataMember<members & EID_GEOMNORMAL, EID_GEOMNORMAL>
    ,public IDataMember<members & EID_NORMAL, EID_NORMAL>
    ,public IDataMember<members & EID_TANGENTS, EID_TANGENTS>
    ,public IDataMember<members & EID_TEXCOORDS, EID_TEXCOORDS>
    ,public IDataMember<members & EID_RAYDIR, EID_RAYDIR>
    ,public IDataMember<members & EID_RECURSIONDEPTH, EID_RECURSIONDEPTH>
{
    ShrinkData()
        :IDataMember<members & EID_POSITION, EID_POSITION>()
        ,IDataMember<members & EID_T, EID_T>()
        ,IDataMember<members & EID_GEOMNORMAL, EID_GEOMNORMAL>()
        ,IDataMember<members & EID_NORMAL, EID_NORMAL>()
        ,IDataMember<members & EID_TANGENTS, EID_TANGENTS>()
        ,IDataMember<members & EID_TEXCOORDS, EID_TEXCOORDS>()
        ,IDataMember<members & EID_RAYDIR, EID_RAYDIR>()
        ,IDataMember<members & EID_RECURSIONDEPTH, EID_RECURSIONDEPTH>(){}


    ShrinkData(const Data &iData)
        :IDataMember<members & EID_POSITION, EID_POSITION>(iData)
        ,IDataMember<members & EID_T, EID_T>(iData)
        ,IDataMember<members & EID_GEOMNORMAL, EID_GEOMNORMAL>(iData)
        ,IDataMember<members & EID_NORMAL, EID_NORMAL>(iData)
        ,IDataMember<members & EID_TANGENTS, EID_TANGENTS>(iData)
        ,IDataMember<members & EID_TEXCOORDS, EID_TEXCOORDS>(iData)
        ,IDataMember<members & EID_RAYDIR, EID_RAYDIR>(iData)
        ,IDataMember<members & EID_RECURSIONDEPTH, EID_RECURSIONDEPTH>(iData){}

};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:48:13+00:00Added an answer on May 17, 2026 at 7:48 pm

    According to this link there is a “feature” in compiler that allows only for limited number of loops. Never happened to me. Try to put ptr initialization and the following for loop in a block. Another solution is to create template function that covers the whole snippet, so that the macro becomes something like this:

    #define CASE_N(N) \
    case(N): \
        ptr = requestAndInitialize<N>(data); \
        return;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That is, I'd like to have a tuple of values. The use case on
That's it. If you want to document a function or a class, you put
That's the question. Give only one reason you think why have OODB failed or
That's it. It's a dumb dumb (embarrassing!) question, but I've never used C# before,
That's basically the question, is there a right way to implement operator<< ? Reading
that one has been nagging me ever since I dabbled in web developpement; is
That's the question... Do you think ASP.Net is a technology suitable for high-load sites?
That is, all text and subtags, without the tag of an element itself? Having
That was helpful kgiannakakis. I'm facing a problem as below: a = ['zbc','2.3'] for
That is, if I had two or more sets, and I wanted to return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.