forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How many levels of re-direction until stack space runs out?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Tue Aug 08, 2006 8:07 am    Post subject: How many levels of re-direction until stack space runs out? Reply with quote

I'm just curious, since we can point to pointers, how many levels of this re-direction can the compilier take before it runs out of stack space? Here is an example...
Code:

  int i = 3;
  int* pi = &i;
  int** p2i = π
  int*** p3i = &p2i;
  int**** p4i = &p3i;
  int***** p5i = &p4i;
  int****** p6i = &p5i;
  int******* p7i = &p6i;
  int******** p8i = &p7i;
  int********* p9i = &p8i;
  int********** p10i = &p9i;
  int*********** p11i = &p10i;
  int************ p12i = &p11i;
  int************* p13i = &p12i;
  int************** p14i = &p13i;
  int*************** p15i = &p14i;
  int**************** p16i = &p15i;
  int***************** p17i = &p16i;
  int****************** p18i = &p17i;
  int******************* p19i = &p18i;
  int******************** p20i = &p19i;
  int********************* p21i = &p20i;
  int********************** p22i = &p21i;
  int*********************** p23i = &p22i;
  int************************ p24i = &p23i;
  int************************* p25i = &p24i;
  int************************** p26i = &p25i;
  int*************************** p27i = &p26i;
  int**************************** p28i = &p27i;
  int***************************** p29i = &p28i;
  int****************************** p30i = &p29i;
  int******************************* p31i = &p30i;
  int******************************** p32i = &p31i;
  int********************************* p33i = &p32i;
I'm sure it would slow down any application using such a mass amount of re-direction if it did compile... So could i get an estimate? 3,000?

Last edited by sg57 on Tue Aug 08, 2006 8:13 am; edited 1 time in total
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Tue Aug 08, 2006 8:12 am    Post subject: Reply with quote

i would think that its hard to give a general answer to this, it would heavily depend on how those pointers are actually used :)

but it could be an interisting experience to both write and later read some code that uses such stuff in a non trivial way :)
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Tue Aug 08, 2006 8:15 am    Post subject: Reply with quote

I dont really see an easy way, unless you, by hand, type it all up to 3,000 or however many...

Unless you make an array of pointers, all pointing to the element below them... In theory...
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Tue Aug 08, 2006 8:22 am    Post subject: Reply with quote

Dereferencing pointers has nothing to do with the stack. You could dereference pointers all day if you felt like it. The only issue is that you actually need to store the pointers somewhere, so the limit would be the amount of RAM you have available.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group