Raised This Month: $ Target: $400
 0% 

Run time error 3 - Stack Error - is there a pragma I need?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-05-2006 , 14:09  
Reply With Quote #4

You see, that's a lot of memory. 150*128*4 = 76800 = 75 kB on the stack... Should be avoided when possible (although the compiler _should_ have computed the estimated stack size correctly in this case I think.. hmm.)

Instead, you could only hold a buffer for one line and process them on the fly ( in the body of the loop which has read_file in its condition ). This way you also wouldn't need to re-evaluate the length of each line (read_file fills it in the last parameter). I was also a bit surprised that you reserved a 128 byte buffer for each line and then told read_file to return 31 characters at max. You may want to use a constant for the line buffer length so you don't have to change it in two places (but then do constant+1 in the buffer declaration).

You may also want to try using the new file natives.
Also, the // Semicolon before module name found comment was misleading I'm afraid.

Well, my thoughts.
__________________
hello, i am pm
PM is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode