TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: david nugent
from: Nhan Tran
date: 1993-11-14 11:59:00
subject: Feeding arrays

> I've used it to the extreme (to revenge?) by creating a
 > dynamic array and realloc() everytime the size of the array
 > is incremented. The compiler and the library happened to be
 > Microsoft C6.?.
 
 dn> I'm not sure that the analysis is particularly fair or accurate. I've
 dn> used C6's (to be precise, 6.0A) realloc() extensively and have never
 dn> hit the same problem, and some of the software in which it is used has

I was in a terrible mood after having been forced to spend an hour on a
"quick hack" task because of the bug. I tried to reproduce the
error after reading your message but couldn't. The code had been modified
to fix other bugs elsewhere. Seems like one of these bugs inadvertently
changed the code in realloc() and made it look like MSC6 realloc()'s fault.
Thanks for your clarification and apology to all.

 dn> Could this be yet another case of the "scanf() syndrome"?  :-)

Maybe. Maybe not. realloc() is not as powerful and difficult to master as
scanf(). It's just one of the functions I dislike because of personal
reasons:

realloc() -> memory fragmentation -> inefficient use of heap =>
why not design a better algo for the program?

strtok() -> change the string, defined inconsistent behaviour, some
compilers use non re-entrant code => use with care

strncat() -> inconsistent naming convention

BTW, scanf() is one of my favourite functions.


--- GEcho 1.01+

* Origin: The InterACTive BBS - Canberra ACT - (06) 292-6200 (3:620/243)
SEEN-BY: 50/99 54/54 99 620/243 250 252 622/405 623/630 711/401 409 430 807
SEEN-BY: 711/808 809 932 934 712/623 627 713/888 714/906 800/1
@PATH: 620/243 54/54 99 711/808 809 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™.