TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: David Nugent
from: Frank Adam
date: 1996-06-24 04:27:08
subject: Memory Blocks snuffed ?

G'Day David,
 
-=> Quoting David Nugent to Frank Adam <=-
 > DN> I'm still not sure what you're attempting to achieve that
 > DN> realloc() does not do already.
 
 > Stand alone functions.

 DN> But "stand-alone functions" are most useful when they are compiler 
 DN> independant. You're talking to someone who has dragged a 
Must admit i did assume that most major compilers would implement 
heapwalk() or the like,in which case the RTL would have to handle 
blocks.
In that case the OS it's compiled for should not make a difference.(??)      

 DN> The advantage is obvious: you can pick up your code and use it
 DN> elsewhere in a  different job, give it to someone else to use or
 DN> maintain,  put it away for four years and dig it out later - and the 
 DN> code requires little or no modification. That's called 
 DN> reusability. Code which is compiler (and maybe version) 
 DN> dependant does not have that attribute.
Yes, i know what you mean, since i may be defecting to Watcom, i'll 
probably have a lot of BC code to re-write or just toss.

 > 1. Assume. (the caller properly allocated the required memory).
 > 2. Re-allocate. (the size of the variable to the required length).
 DN> Or your program can keep track of the memory itself. It only takes one
 DN> or two  variables.
 DN> If you prefer an OOP style of writing C code (which I do), then doing
 DN> this is  trivial, and largely invisible to the user of the code. You 
You mean a mix of C and classes ? I do that sometimes. 

 DN> My experience is that the need to reallocate almost always stems from
 DN> one of  two scenarios. The first is an array, as I've just 
 DN> mentioned. The second is a buffer that contains text, which 
 DN> you are adding, removing or searching (such as you'd find 
In that case the String class alone would do that i believe.. 
  
 > and in my spare time, so as long as i'm not losing money...:)
Reason i've said this was, that i may sit down to make a program and if
i was to fail i'd be disappointed, but sometimes i'd just play around
with far fetched ideas, and in that case i accept failure.

 DN> I'm not picking bones, Frank, really - I'm just trying to convince you
No, i'm bound to be very wrong on a number of subjects, so i do appreciate
being told where and when i'm wrong.(i may even admit it :-))
Just don't swear at me publicly :-) 

 DN> IMHO, it is better to do the thing right the first time and avoid work
 DN> in the  future. I'm not particularly interested in reinventing 
 DN> wheels :-) - I'd rather actually achieve something at the 
 DN> end of the day that works, and works reliably.
True, i'm in the process of getting a few different s/h compilers, and 
setting up the PC so i can run different OSs from the RHD rack.
After that i may be a bit smarter..and probably very tired and confused.


  L8r Frank (fadam{at}ozemail.com.au).
  
___ Blue Wave/DOS v2.21

--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413
SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/544 50/99 711/808 934

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™.