TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Wankadia
from: Frank Adam
date: 1996-10-26 14:13:02
subject: Auto string-length deter

G'Day Paul,
 
-=> Quoting Paul Wankadia to Frank Adam <=-

 PW> Yeah, but if I start using classes and objects all over the place and
 PW> then start asking about them in HERE... <:-\
Yeah, suppose the odd query might be ok, but it is a C echo, i think i saw
an aussie c++ echo around some time back, mixing the two might be a good 
idea.However i firmly believe C should be quite clear before starting 
on C++.
 
 FA> (after all i wrote it for the same task you're working on):)
 PW> You tried to do the EXACT same thing?!?  Cool -- can I get a look at
 PW> your code too?
Only if i re-write it, as these days i write close to (mostly) portable 
code i had no real use for it. 
In my old code which Paul posted, the smrtRealloc() function does just 
about everything(i should really deny ever writing it :)).
Your call would go like this.. 

smemsize = smartrealloc(string,0,SRGETSIZE);
if(smemsize < neededsize) smartrealloc(s,neededsize,??) i forget now.. :)

Anyway it is relatively simple if you look at it, needs a few changes 
to make it more user friendly, the current way of calling the function 
is quite stupid. 
One more note, form memory this will not work on static variables, only 
dynamically allocated ones. 
Eg using 
char hello[20]; may not work, 
 but
char* hello = malloc(20); will.
 
 PW> Well, if heapwalk() is so useful, why not?  Maybe someone could code
 PW> their own portable heapwalk() and post it here???
Because it has a new name now which may give away a few hints..
_rtl_heapwalk();
It is solely bound to the run time library, if per se MSC's RTL does not
actually manage the memory, you won't find that sort of function in it.
Pacific does not, and i could not find any way to track the memory through 
it, without perhaps writing an malloc front end. 
Even if all compilers had their own memory manager built in, can you 
imagine the port ? 687 lines of #ifs followed by 30-40 lines of code. :) 
I'm tossing around making a full blown alloc frontend, but that will be 
a very large project and i have to do other things first, plus a couple 
of smaller ones needs finishing, so don't hold your breath. 
  
  L8r Frank (fadam{at}ozemail.com.au).
  
___ Blue Wave/DOS v2.21
                                                        

---
* Origin: Melbourne PC User Group BBS (3:632/309)
SEEN-BY: 633/267 270
@PATH: 632/309 107 635/503 50/99 635/728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.